qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org, leiyang@redhat.com,
	marcandre.lureau@redhat.com,
	"Hailiang Zhang" <zhanghailiang@xfusion.com>,
	"Fabiano Rosas" <farosas@suse.de>
Subject: Re: [PATCH v4 05/12] migration: qemu_file_set_blocking(): add errp parameter
Date: Tue, 16 Sep 2025 09:51:16 -0400	[thread overview]
Message-ID: <aMlrVHYxhuj1TYYL@x1.local> (raw)
In-Reply-To: <7f6b159e-6d97-4b0e-a825-7b8042c27e99@yandex-team.ru>

On Tue, Sep 16, 2025 at 04:01:57PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> On 16.09.25 11:28, Daniel P. Berrangé wrote:
> > On Mon, Sep 15, 2025 at 04:18:58PM -0400, Peter Xu wrote:
> > > On Mon, Sep 15, 2025 at 10:30:57PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> > > > qemu_file_set_blocking() is a wrapper on qio_channel_set_blocking(),
> > > > so let's passthrough the errp.
> > > This looks all reasonable in general.
> > > 
> > > Said that, using error_abort in migration code normally are not suggested
> > > because it's too strong.
> > Note, that prior to this series, the existing qemu_socket_set_nonblock
> > method that migration is calling will assert on failure. This series
> > removes that assert and propagates it back to the callers to let them
> > decide what to do. Ideally they would gracefully handle it, but if
> > they assert that is no worse than current behaviour.
> > 
> 
> In details, prior to series:
> 
> posix + set_nonblock -> crash on failure
> 
> other variants (posix/win32 + set_block, win32 + set_nonblock) -> ignore failure

Correct, but IIUC that's for sockets only.

Major channel types that migration cares the most should also include file
now.  qio_channel_file_set_blocking() also doesn't assert but return a
failure.

> 
> > > I did check all of below should be on the incoming side which is not as
> > > severe (because killing dest qemu before switchover is normally
> > > benign). Still, can we switch all below users to error_warn (including the
> > > one below that may want to error_report_err(), IMHO a warn report is fine
> > > even for such error)?
> > IMHO ignoring a failure to change the blocking flag status is not
> > a warnnig, it is unrecoverable for the migration operation. It
> > should be possible to propagate the error in some way, but it will
> > potentially require changes across multiple migration methods to
> > handle this.

In most cases I agree.  But still, using error_abort doesn't mean to fail
migration, but to crash the VM.  We still at least doesn't want to do it on
src..

Meanwhile, this could violate things like newly introduced exit-on-error,
but I agree we used to ignore those, so even if it fails before and didn't
crash, we could have ignored those errors.. and not reportable to libvirt.

The ideal way to do is to always fail either src/dst when set blocking
failed for sure, but yes, it's slightly involved on some paths this patch
touched.

So.. I think we can go with this patch, with a sincere wish that it'll
simply almost never fail.  But then, let's mention that in the commit
message, (1) this patch only asserts on the dest qemu and only before
switchover (hence src can still fallback), never src, (2) state the facts
that it so far is a slight violation to exit-on-error, but it's extremely
unlikely to happen anyway (NOTE: this is not a programming error that
normal assertions would do, so it falls into exit-on-error category).

Thanks,

-- 
Peter Xu



  reply	other threads:[~2025-09-16 13:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15 19:30 [PATCH v4 00/12] io: deal with blocking/non-blocking fds Vladimir Sementsov-Ogievskiy
2025-09-15 19:30 ` [PATCH v4 01/12] char-socket: tcp_chr_recv(): drop extra _set_(block, cloexec) Vladimir Sementsov-Ogievskiy
2025-09-15 19:30 ` [PATCH v4 02/12] char-socket: tcp_chr_recv(): add comment Vladimir Sementsov-Ogievskiy
2025-09-15 19:30 ` [PATCH v4 03/12] util: add qemu_set_blocking() function Vladimir Sementsov-Ogievskiy
2025-09-15 19:30 ` [PATCH v4 04/12] handle result of qio_channel_set_blocking() Vladimir Sementsov-Ogievskiy
2025-09-16  8:22   ` Daniel P. Berrangé
2025-09-15 19:30 ` [PATCH v4 05/12] migration: qemu_file_set_blocking(): add errp parameter Vladimir Sementsov-Ogievskiy
2025-09-15 20:18   ` Peter Xu
2025-09-16  5:42     ` Vladimir Sementsov-Ogievskiy
2025-09-16  8:28     ` Daniel P. Berrangé
2025-09-16 13:01       ` Vladimir Sementsov-Ogievskiy
2025-09-16 13:51         ` Peter Xu [this message]
2025-09-16 15:15           ` Daniel P. Berrangé
2025-09-15 19:30 ` [PATCH v4 06/12] util: drop qemu_socket_set_nonblock() Vladimir Sementsov-Ogievskiy
2025-09-16  8:33   ` Daniel P. Berrangé
2025-09-16 13:02     ` Vladimir Sementsov-Ogievskiy
2025-09-15 19:30 ` [PATCH v4 07/12] util: drop qemu_socket_try_set_nonblock() Vladimir Sementsov-Ogievskiy
2025-09-15 19:31 ` [PATCH v4 08/12] io/channel-socket: rework qio_channel_socket_copy_fds() Vladimir Sementsov-Ogievskiy
2025-09-15 19:31 ` [PATCH v4 09/12] util: drop qemu_socket_set_block() Vladimir Sementsov-Ogievskiy
2025-09-15 19:31 ` [PATCH v4 10/12] use qemu_set_blocking instead of g_unix_set_fd_nonblocking Vladimir Sementsov-Ogievskiy
2025-09-15 19:31 ` [PATCH v4 11/12] chardev: qemu_chr_open_fd(): add errp Vladimir Sementsov-Ogievskiy
2025-09-15 19:31 ` [PATCH v4 12/12] chardev: close an fd on failure path Vladimir Sementsov-Ogievskiy
2025-09-15 19:32 ` [PATCH v4 00/12] 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=aMlrVHYxhuj1TYYL@x1.local \
    --to=peterx@redhat.com \
    --cc=berrange@redhat.com \
    --cc=farosas@suse.de \
    --cc=leiyang@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    --cc=zhanghailiang@xfusion.com \
    /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).