qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: Laurent Vivier <laurent@vivier.eu>,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-ppc@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v4 for-5.2 1/2] spapr: Use error_append_hint() in spapr_caps.c
Date: Tue, 28 Jul 2020 20:09:37 +1000	[thread overview]
Message-ID: <20200728100937.GI84173@umbus.fritz.box> (raw)
In-Reply-To: <20200728110726.5882b046@bahia.lan>

[-- Attachment #1: Type: text/plain, Size: 3154 bytes --]

On Tue, Jul 28, 2020 at 11:07:26AM +0200, Greg Kurz wrote:
> On Tue, 28 Jul 2020 09:26:08 +0200
> Markus Armbruster <armbru@redhat.com> wrote:
> 
> > Greg Kurz <groug@kaod.org> writes:
> > 
> > > On Mon, 20 Jul 2020 17:24:35 +0200
> > > Markus Armbruster <armbru@redhat.com> wrote:
> > >
> > >> Greg Kurz <groug@kaod.org> writes:
> > >> 
> > >> > We have a dedicated error API for hints. Use it instead of embedding
> > >> > the hint in the error message, as recommanded in the "qapi/error.h"
> > >> > header file.
> > >> >
> > >> > Since spapr_caps_apply() passes &error_fatal, all functions must
> > >> > also call the ERRP_GUARD() macro for error_append_hint() to be
> > >> > functional.
> > >> 
> > >> This isn't a request for change in this patch, just an attempt to squash
> > >> possible misunderstandings.
> > >> 
> > >> It's true that error_append_hint() without ERRP_GUARD() works as long as
> > >> the caller doesn't pass certain errp arguments.  But the callee should
> > >> work for all possible @errp arguments, not just the ones that get passed
> > >> today.  That's why error.h wants you to guard *all* uses of
> > >> error_append_hint(errp):
> > >> 
> > >>  * = Why, when and how to use ERRP_GUARD() =
> > >>  *
> > >>  * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> > >>  * - It must not be dereferenced, because it may be null.
> > >>  * - It should not be passed to error_prepend() or
> > >>  *   error_append_hint(), because that doesn't work with &error_fatal.
> > >>  * ERRP_GUARD() lifts these restrictions.
> > >> 
> > >
> > > Yeah, I just wanted to emphasize that we were precisely in the case
> > > where we _really_ need to lift the restriction, but I'm perfectly fine
> > > with dropping this sentence if you consider it useless.
> > 
> > I lean towards dropping it.
> > 
> 
> David,
> 
> Do you want me to send an updated version of this patch or can you
> fix this in your tree ?

Updated version please, I'm afraid I've lost track of quite what was
suggested in this thread.

> 
> > > BTW, should we have a way for CI to ensure that a patch that adds
> > > error_prepend(errp, ...) or error_append_hint(errp, ...) also adds
> > > ERRP_GUARD() ? Not sure that people read error.h that often...
> > 
> > I don't know.  Wait and see whether it's worth automating?  We didn't
> > automate checking other Error API rules, like "no newlines in error
> > messages".  That one can't crash, though.
> > 
> > The check would have to look beyond the patch, which checkpatch.pl
> > doesn't do.
> > 
> 
> <thinking aloud>
> Maybe checkpatch.pl could be fed with an extended version of the patch
> that has enough context, eg. git show -U$(wc -l ${file}) ${file} ?
> </thinking aloud>
> 
> > >> No need to make an argument involving the possible arguments (pardon the
> > >> pun).
> > >> 
> > >
> > > :)
> > >
> > >> [...]
> > >> 
> > 
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-07-28 10:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 17:10 [PATCH v4 for-5.2 0/2] spapr: Improve error reporting in spapr_caps.c Greg Kurz
2020-07-16 17:11 ` [PATCH v4 for-5.2 1/2] spapr: Use error_append_hint() " Greg Kurz
2020-07-17  5:57   ` David Gibson
2020-07-20 15:24   ` Markus Armbruster
2020-07-27 13:04     ` Greg Kurz
2020-07-28  7:26       ` Markus Armbruster
2020-07-28  9:07         ` Greg Kurz
2020-07-28 10:09           ` David Gibson [this message]
2020-07-16 17:11 ` [PATCH v4 for-5.2 2/2] spapr: Forbid nested KVM-HV in pre-power9 compat mode Greg Kurz
2020-07-17  5:58   ` David Gibson

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=20200728100937.GI84173@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=armbru@redhat.com \
    --cc=groug@kaod.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=vsementsov@virtuozzo.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).