All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Arun Menon" <armenon@redhat.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"David Hildenbrand" <david@redhat.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Fam Zheng" <fam@euphon.net>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
	"Hailiang Zhang" <zhanghailiang@xfusion.com>,
	"Steve Sistare" <steven.sistare@oracle.com>,
	qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
	"Matthew Rosato" <mjrosato@linux.ibm.com>
Subject: Re: [PATCH v6 23/24] migration: Add error-parameterized function variants in VMSD struct
Date: Mon, 25 Aug 2025 14:00:03 +0200	[thread overview]
Message-ID: <87v7mbsjb0.fsf@pond.sub.org> (raw)
In-Reply-To: <e4325c6b-f543-4f1b-862a-290e51c80999@rsg.ci.i.u-tokyo.ac.jp> (Akihiko Odaki's message of "Sun, 10 Aug 2025 13:59:47 +0900")

Please excuse the delayed response, I was on vacation.

Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> writes:

> On 2025/08/09 23:30, Markus Armbruster wrote:
>> Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> writes:

[...]

>>> There were three options on the table: bool, int, and void.
>>>
>>> The previous discussion you referred explains why void should be avoided, and include/qapi/error.h also says void should be avoided.
>>>
>>> There is pre_load() that does not use Error returns int, but now we are adding pre_load_errp() that uses Error.
>>>
>>> Then what pre_load_errp() should return: bool or int?
>>
>> I like bool when it's all we need.
>>
>> When we need to return a non-negative int on success, use int and return
>> -1 or a negative error code on failure.
>>
>> Another reason to pick int is local consistency: related functions
>> already use int.
>>
>> Changing working code from int to bool doesn't seem worth the bother.
>>
>> Questions?
>
> I at least see what "[PATCH v9 26/27] migration: Add error-parameterized function variants in VMSD struct" says is undesirable. It says:
>
>> For the errp variants,
>> Returns: 0 on success,
>>          <0 on error where -value is an error number from errno.h

Does any caller use errno codes to discriminate between failures?

> There are already non-errp variant implementations that return -1 (e.g., dbus_vmstate_post_load). Adding errp variants that require to return errno is degradation.

However, the non-errp variants are intended to be removed.  Any
inconsistency with them would hopefully be temporary.  We can accept
that when other considerations call for it.

> I'm still not sure what conclusion will be drawn. I can make two opposite conclusions:
>
> - Non-errp variants return int, so errp variants should also return int
>   for local consistency.
>
> - bool is all we need, but changing non-errp variants doesn't seem worth
>   the bother, so only errp variants should return bool.

Here's my recommendation.

If any caller needs to use errno codes, use int and return -errno on
failure.  This is inconsistent with the old callbacks, but callers'
needs trump that.

Else if we want consistency with the old callbacks even though we intend
to remove them, use int and return -1 on failure.

Else use bool and return false on failure.



  reply	other threads:[~2025-08-25 12:01 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21 11:29 [PATCH v6 00/24] migration: propagate vTPM errors using Error objects Arun Menon
2025-07-21 11:29 ` [PATCH v6 01/24] migration: push Error **errp into vmstate_subsection_load() Arun Menon
2025-07-21 12:10   ` Akihiko Odaki
2025-07-25  7:09     ` Arun Menon
2025-07-21 11:29 ` [PATCH v6 02/24] migration: push Error **errp into vmstate_load_state() Arun Menon
2025-07-21 12:24   ` Akihiko Odaki
2025-07-25  7:11     ` Arun Menon
2025-07-21 12:30   ` Marc-André Lureau
2025-07-25  7:12     ` Arun Menon
2025-07-21 11:29 ` [PATCH v6 03/24] migration: push Error **errp into qemu_loadvm_state_header() Arun Menon
2025-07-21 12:34   ` Marc-André Lureau
2025-07-25  7:12     ` Arun Menon
2025-07-21 11:29 ` [PATCH v6 04/24] migration: push Error **errp into vmstate_load() Arun Menon
2025-07-21 11:29 ` [PATCH v6 05/24] migration: push Error **errp into qemu_loadvm_section_start_full() Arun Menon
2025-07-21 11:29 ` [PATCH v6 06/24] migration: push Error **errp into qemu_loadvm_section_part_end() Arun Menon
2025-07-21 11:29 ` [PATCH v6 07/24] migration: Update qemu_file_get_return_path() docs and remove dead checks Arun Menon
2025-07-21 12:24   ` Daniel P. Berrangé
2025-07-21 11:29 ` [PATCH v6 08/24] migration: push Error **errp into loadvm_process_command() Arun Menon
2025-07-21 12:38   ` Akihiko Odaki
2025-07-25  7:13     ` Arun Menon
2025-07-21 11:29 ` [PATCH v6 09/24] migration: push Error **errp into loadvm_handle_cmd_packaged() Arun Menon
2025-07-21 11:29 ` [PATCH v6 10/24] migration: push Error **errp into ram_postcopy_incoming_init() Arun Menon
2025-07-21 11:29 ` [PATCH v6 11/24] migration: push Error **errp into loadvm_postcopy_handle_advise() Arun Menon
2025-07-21 12:43   ` Akihiko Odaki
2025-07-25  7:14     ` Arun Menon
2025-07-21 11:29 ` [PATCH v6 12/24] migration: push Error **errp into loadvm_postcopy_handle_listen() Arun Menon
2025-07-21 11:29 ` [PATCH v6 13/24] migration: push Error **errp into loadvm_postcopy_handle_run() Arun Menon
2025-07-21 11:29 ` [PATCH v6 14/24] migration: push Error **errp into loadvm_postcopy_ram_handle_discard() Arun Menon
2025-07-21 11:29 ` [PATCH v6 15/24] migration: make loadvm_postcopy_handle_resume() void Arun Menon
2025-07-21 12:46   ` Akihiko Odaki
2025-07-25  7:15     ` Arun Menon
2025-07-21 11:29 ` [PATCH v6 16/24] migration: push Error **errp into loadvm_handle_recv_bitmap() Arun Menon
2025-07-21 11:29 ` [PATCH v6 17/24] migration: push Error **errp into loadvm_process_enable_colo() Arun Menon
2025-07-21 11:29 ` [PATCH v6 18/24] migration: push Error **errp into loadvm_postcopy_handle_switchover_start() Arun Menon
2025-07-21 11:29 ` [PATCH v6 19/24] migration: push Error **errp into qemu_loadvm_state_main() Arun Menon
2025-07-21 11:29 ` [PATCH v6 20/24] migration: push Error **errp into qemu_loadvm_state() Arun Menon
2025-07-21 13:01   ` Akihiko Odaki
2025-07-25  7:09     ` Arun Menon
2025-07-21 11:29 ` [PATCH v6 21/24] migration: push Error **errp into qemu_load_device_state() Arun Menon
2025-07-21 11:29 ` [PATCH v6 22/24] migration: Capture error in postcopy_ram_listen_thread() Arun Menon
2025-07-21 11:29 ` [PATCH v6 23/24] migration: Add error-parameterized function variants in VMSD struct Arun Menon
2025-07-21 13:14   ` Akihiko Odaki
2025-07-21 13:29     ` Daniel P. Berrangé
2025-07-21 15:15       ` Akihiko Odaki
2025-08-09  8:17         ` Markus Armbruster
2025-08-09  9:53           ` Akihiko Odaki
2025-08-09 14:30             ` Markus Armbruster
2025-08-10  4:59               ` Akihiko Odaki
2025-08-25 12:00                 ` Markus Armbruster [this message]
2025-07-21 13:32   ` Daniel P. Berrangé
2025-07-21 13:54     ` Arun Menon
2025-07-21 14:05       ` Daniel P. Berrangé
2025-07-21 15:10         ` Arun Menon
2025-07-25  6:39           ` Arun Menon
2025-07-21 11:29 ` [PATCH v6 24/24] backends/tpm: Propagate vTPM error on migration failure Arun Menon

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=87v7mbsjb0.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=armenon@redhat.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=danielhb413@gmail.com \
    --cc=david@redhat.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=fam@euphon.net \
    --cc=farman@linux.ibm.com \
    --cc=farosas@suse.de \
    --cc=harshpb@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=steven.sistare@oracle.com \
    --cc=thuth@redhat.com \
    --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 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.