All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: farosas@suse.de, "open list:All patches CC here" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2 16/16] migration/vmstate-types: move to new migration APIs
Date: Wed, 4 Mar 2026 13:20:02 -0500	[thread overview]
Message-ID: <aah30gY41yCv1nz6@x1.local> (raw)
In-Reply-To: <6ca052d7-c7b1-4ab0-9bb4-39a78874cf96@yandex-team.ru>

On Wed, Mar 04, 2026 at 08:38:04PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> On 03.03.26 19:56, Peter Xu wrote:
> > On Sat, Feb 21, 2026 at 12:02:14AM +0300, Vladimir Sementsov-Ogievskiy wrote:
> > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> > 
> > Reviewed-by: Peter Xu <peterx@redhat.com>
> > 
> > Likewise.. one trivial thing to mention below..
> > 
> > [...]
> > 
> > >   /* 32 bit int. See that the received value is the same than the one
> > >      in the field */
> > > -static int get_int32_equal(QEMUFile *f, void *pv, size_t size,
> > > -                           const VMStateField *field)
> > > +static bool load_int32_equal(QEMUFile *f, void *pv, size_t size,
> > > +                             const VMStateField *field, Error **errp)
> > >   {
> > > +    ERRP_GUARD();
> > >       int32_t *v = pv;
> > >       int32_t v2;
> > >       qemu_get_sbe32s(f, &v2);
> > >       if (*v == v2) {
> > > -        return 0;
> > > +        return true;
> > >       }
> > > -    error_report("%" PRIx32 " != %" PRIx32, *v, v2);
> > > +
> > > +    error_setg(errp, "%" PRIx32 " != %" PRIx32, *v, v2);
> > >       if (field->err_hint) {
> > > -        error_printf("%s\n", field->err_hint);
> > > +        error_append_hint(errp, "%s\n", field->err_hint);
> > 
> > According to doc for error_append_hint():
> > 
> > /*
> >   * Append a printf-style human-readable explanation to an existing error.
> >   * If the error is later reported to a human user with
> >   * error_report_err() or warn_report_err(), the hints will be shown,
> >   * too.  If it's reported via QMP, the hints will be ignored.
> >   * Intended use is adding helpful hints on the human user interface,
> >   * e.g. a list of valid values.  It's not for clarifying a confusing
> >   * error message.
> >   * @errp may be NULL, but not &error_fatal or &error_abort.
> >   * Trivially the case if you call it only after error_setg() or
> >   * error_propagate().
> >   * May be called multiple times.  The resulting hint should end with a
> >   * newline.
> >   */
> > 
> > It may be ignored if the errp will be finally persisted in MigrationState.
> > 
> > Not a huge deal because I believe we also do error_report_err()
> > somewhere.. but if we want, I think we could use error_append() to make the
> > hint available to both.
> > 
> > This comment applies to all 5 similar occurances in this patch.
> 
> Agree, will do. That was intuitive choice "err_hint" -> "append_hint".
> 
> Actually, I'm unsure, how much is good to omit hints for QMP interface.
> Of course, QMP is for machines. But provided errors are for humans anyway,
> machines never parse them (OK, sometimes they do, but that's not a good
> practice).
> 
> I always wandered, why we try to hide information when reporting errors:
> don't report filename, line number.. Don't report these hints. In production
> solutions final user will never see any errors from QEMU, so these error
> messages are only for engineers. Why we have to grep error messages in
> code, instead of get exact filename and line number?

I confess I don't know a solid answer.

My expectation on whatever that will be visible via QMP is, there is always
chance an user will read the message as-is.

Maybe reading file name and line numbers are too much for most users,
especially if that'll be a default behavior for all errors.  So it makes
some sense to me to not include those at least in most errors.

For this specific one, I think it's slightly different: here we already
report something as hard to understand to the user with an "A != B"
message..  hence maybe it'll always be good to prepend with "what is put
into the equation", until we will change that to a more human-friendly
error..

-- 
Peter Xu



  reply	other threads:[~2026-03-04 18:20 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260220210214.800050-1-vsementsov@yandex-team.ru>
2026-02-20 21:01 ` [PATCH v2 01/16] migration: vmstate_save_state_v: fix double error_setg Vladimir Sementsov-Ogievskiy
2026-02-27 22:14   ` Fabiano Rosas
2026-03-03 14:30   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 02/16] migration: make vmstate_save_state_v() static Vladimir Sementsov-Ogievskiy
2026-02-27 22:15   ` Fabiano Rosas
2026-03-03 15:01   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 03/16] migration: make .post_save() a void function Vladimir Sementsov-Ogievskiy
2026-02-27 22:41   ` Fabiano Rosas
2026-02-27 23:56     ` Vladimir Sementsov-Ogievskiy
2026-03-03 15:05       ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 04/16] migration: vmstate_load_state(): add some newlines Vladimir Sementsov-Ogievskiy
2026-02-27 22:41   ` Fabiano Rosas
2026-03-03 15:06   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 05/16] migration: vmstate_save/load_state(): stop tracing errors Vladimir Sementsov-Ogievskiy
2026-02-27 22:44   ` Fabiano Rosas
2026-03-03 15:13     ` Peter Xu
2026-03-04 16:10       ` Vladimir Sementsov-Ogievskiy
2026-02-20 21:02 ` [PATCH v2 06/16] migration: factor out vmstate_pre_save() from vmstate_save_state() Vladimir Sementsov-Ogievskiy
2026-03-03 15:22   ` Peter Xu
2026-03-04 16:27     ` Vladimir Sementsov-Ogievskiy
2026-03-04 16:42       ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 07/16] migration: factor out vmstate_save_field() " Vladimir Sementsov-Ogievskiy
2026-03-03 15:38   ` Peter Xu
2026-03-04 17:22     ` Vladimir Sementsov-Ogievskiy
2026-02-20 21:02 ` [PATCH v2 08/16] migration: factor out vmstate_pre_load() from vmstate_load_state() Vladimir Sementsov-Ogievskiy
2026-03-03 16:11   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 09/16] migration: factor out vmstate_load_field() " Vladimir Sementsov-Ogievskiy
2026-03-03 16:14   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 10/16] migration: factor out vmstate_post_load() " Vladimir Sementsov-Ogievskiy
2026-03-03 16:16   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 11/16] migration: convert vmstate_subsection_save/load functions to bool Vladimir Sementsov-Ogievskiy
2026-03-03 16:17   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 12/16] migration: VMStateInfo: introduce new handlers with errp Vladimir Sementsov-Ogievskiy
2026-03-03 16:19   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 13/16] migration: introduce vmstate_load_vmsd() and vmstate_save_vmsd() Vladimir Sementsov-Ogievskiy
2026-03-03 16:22   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 14/16] migration/cpr: move to new migration APIs Vladimir Sementsov-Ogievskiy
2026-03-03 16:23   ` Peter Xu
2026-02-20 21:02 ` [PATCH v2 15/16] migration/savevm: " Vladimir Sementsov-Ogievskiy
2026-03-03 16:42   ` Peter Xu
2026-03-04 17:04     ` Vladimir Sementsov-Ogievskiy
2026-02-20 21:02 ` [PATCH v2 16/16] migration/vmstate-types: " Vladimir Sementsov-Ogievskiy
2026-03-03 16:56   ` Peter Xu
2026-03-04 17:38     ` Vladimir Sementsov-Ogievskiy
2026-03-04 18:20       ` Peter Xu [this message]
2026-03-04 19:15     ` Vladimir Sementsov-Ogievskiy
2026-03-04 19:20       ` Peter Xu
2026-03-04 20:06         ` Vladimir Sementsov-Ogievskiy
2026-03-04 21:53           ` Peter Xu
2026-02-20 21:05 ` [PATCH v2 00/16] migration: more bool+errp APIs 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=aah30gY41yCv1nz6@x1.local \
    --to=peterx@redhat.com \
    --cc=farosas@suse.de \
    --cc=qemu-devel@nongnu.org \
    --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 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.