qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: qemu-devel@nongnu.org, peterx@redhat.com, qemu-block@nongnu.org,
	leiyang@redhat.com, marcandre.lureau@redhat.com,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Gustavo Romero <gustavo.romero@linaro.org>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Michael Roth <michael.roth@amd.com>,
	Kostiantyn Kostiuk <kkostiuk@redhat.com>,
	Alexander Bulekov <alxndr@bu.edu>, Bandan Das <bsd@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Fabiano Rosas <farosas@suse.de>,
	Darren Kenny <darren.kenny@oracle.com>,
	Qiuhao Li <Qiuhao.Li@outlook.com>,
	Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH v2 8/8] use qemu_set_blocking instead of g_unix_set_fd_nonblocking
Date: Fri, 12 Sep 2025 18:11:52 +0100	[thread overview]
Message-ID: <aMRUWCLd_U6FRLM9@redhat.com> (raw)
In-Reply-To: <20250911092007.1370002-9-vsementsov@yandex-team.ru>

On Thu, Sep 11, 2025 at 12:20:06PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Instead of open-coded g_unix_set_fd_nonblocking() calls, use
> QEMU wrapper qemu_set_blocking().
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
>  chardev/char-fd.c                  |  4 ++--
>  chardev/char-pty.c                 |  3 +--
>  chardev/char-serial.c              |  3 +--
>  chardev/char-stdio.c               |  3 +--
>  hw/input/virtio-input-host.c       |  3 +--
>  hw/misc/ivshmem-flat.c             |  3 ++-
>  hw/misc/ivshmem-pci.c              |  7 ++++++-
>  hw/virtio/vhost-vsock.c            |  8 ++------
>  io/channel-command.c               |  9 ++++++---
>  io/channel-file.c                  |  3 +--
>  net/tap-bsd.c                      | 12 ++++++++++--
>  net/tap-linux.c                    |  7 ++++++-
>  net/tap-solaris.c                  |  7 ++++++-
>  net/tap.c                          | 21 ++++++---------------
>  qga/commands-posix.c               |  3 +--
>  tests/qtest/fuzz/virtio_net_fuzz.c |  2 +-
>  tests/qtest/vhost-user-test.c      |  3 +--
>  tests/unit/test-iov.c              |  5 +++--
>  ui/input-linux.c                   |  3 +--
>  util/event_notifier-posix.c        |  4 ++--
>  util/main-loop.c                   |  5 ++++-
>  21 files changed, 64 insertions(+), 54 deletions(-)
> 
> diff --git a/chardev/char-fd.c b/chardev/char-fd.c
> index 6f03adf872..739dc68c36 100644
> --- a/chardev/char-fd.c
> +++ b/chardev/char-fd.c
> @@ -212,8 +212,8 @@ void qemu_chr_open_fd(Chardev *chr,
>      FDChardev *s = FD_CHARDEV(chr);
>      g_autofree char *name = NULL;
>  
> -    if (fd_out >= 0 && !g_unix_set_fd_nonblocking(fd_out, true, NULL)) {
> -        assert(!"Failed to set FD nonblocking");
> +    if (fd_out >= 0) {
> +        qemu_set_blocking(fd_out, false, &error_abort);

Every caller of this method has an 'errp' available that we
can plumb into qemu_chr_open_fd().

>      }
>  
>      if (fd_out == fd_in && fd_in >= 0) {


> diff --git a/hw/misc/ivshmem-flat.c b/hw/misc/ivshmem-flat.c
> index fe4be6be17..89495f6a11 100644
> --- a/hw/misc/ivshmem-flat.c
> +++ b/hw/misc/ivshmem-flat.c
> @@ -154,7 +154,8 @@ static void ivshmem_flat_add_vector(IvshmemFTState *s, IvshmemPeer *peer,
>       * peer.
>       */
>      peer->vector[peer->vector_counter].id = peer->vector_counter;
> -    g_unix_set_fd_nonblocking(vector_fd, true, NULL);
> +    /* WARNING: qemu_socket_set_nonblock() return code ignored */
> +    qemu_set_blocking(vector_fd, false, NULL);

Perhaps &warn_report so we at least diagnose this awkward situation ?

>      event_notifier_init_fd(&peer->vector[peer->vector_counter].event_notifier,
>                             vector_fd);
>  





With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-09-12 17:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11  9:19 [PATCH v2 0/8] io: deal with blocking/non-blocking fds Vladimir Sementsov-Ogievskiy
2025-09-11  9:19 ` [PATCH v2 1/8] char-socket: tcp_chr_recv(): drop extra _set_(block, cloexec) Vladimir Sementsov-Ogievskiy
2025-09-12 16:49   ` [PATCH v2 1/8] char-socket: tcp_chr_recv(): drop extra _set_(block,cloexec) Daniel P. Berrangé
2025-09-11  9:20 ` [PATCH v2 2/8] char-socket: tcp_chr_recv(): add comment Vladimir Sementsov-Ogievskiy
2025-09-12 16:50   ` Daniel P. Berrangé
2025-09-11  9:20 ` [PATCH v2 3/8] util: add qemu_set_blocking() function Vladimir Sementsov-Ogievskiy
2025-09-12 16:51   ` Daniel P. Berrangé
2025-09-11  9:20 ` [PATCH v2 4/8] util: drop qemu_socket_set_nonblock() Vladimir Sementsov-Ogievskiy
2025-09-12 16:59   ` Daniel P. Berrangé
2025-09-15  8:07     ` Vladimir Sementsov-Ogievskiy
2025-09-15  8:09     ` Vladimir Sementsov-Ogievskiy
2025-09-11  9:20 ` [PATCH v2 5/8] util: drop qemu_socket_try_set_nonblock() Vladimir Sementsov-Ogievskiy
2025-09-12 17:00   ` Daniel P. Berrangé
2025-09-11  9:20 ` [PATCH v2 6/8] io/channel-socket: rework qio_channel_socket_copy_fds() Vladimir Sementsov-Ogievskiy
2025-09-12 17:05   ` Daniel P. Berrangé
2025-09-15  8:47     ` Vladimir Sementsov-Ogievskiy
2025-09-11  9:20 ` [PATCH v2 7/8] util: drop qemu_socket_set_block() Vladimir Sementsov-Ogievskiy
2025-09-12 17:06   ` Daniel P. Berrangé
2025-09-11  9:20 ` [PATCH v2 8/8] use qemu_set_blocking instead of g_unix_set_fd_nonblocking Vladimir Sementsov-Ogievskiy
2025-09-12 17:11   ` Daniel P. Berrangé [this message]
2025-09-15 10:04     ` Vladimir Sementsov-Ogievskiy
2025-09-11  9:22 ` [PATCH v2 0/8] io: deal with blocking/non-blocking fds Vladimir Sementsov-Ogievskiy

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=aMRUWCLd_U6FRLM9@redhat.com \
    --to=berrange@redhat.com \
    --cc=Qiuhao.Li@outlook.com \
    --cc=alxndr@bu.edu \
    --cc=bsd@redhat.com \
    --cc=darren.kenny@oracle.com \
    --cc=farosas@suse.de \
    --cc=gustavo.romero@linaro.org \
    --cc=jasowang@redhat.com \
    --cc=kkostiuk@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=leiyang@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    /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).