qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Daniel Black <daniel@linux.ibm.com>
Cc: "open list:sPAPR" <qemu-ppc@nongnu.org>,
	Greg Kurz <groug@kaod.org>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v2] spapr: quantify error messages regarding capability settings
Date: Sun, 4 Aug 2019 13:29:15 +1000	[thread overview]
Message-ID: <20190804032915.GC9535@umbus.fritz.box> (raw)
In-Reply-To: <20190802110348.60f22d92@volution.ozlabs.ibm.com>

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

On Fri, Aug 02, 2019 at 11:03:48AM +1000, Daniel Black wrote:
> On Thu, 1 Aug 2019 12:41:59 +0200
> Greg Kurz <groug@kaod.org> wrote:
> 
> > On Thu,  1 Aug 2019 13:38:19 +1000
> > Daniel Black <daniel@linux.ibm.com> wrote:
> > 
> > > Its not immediately obvious how cap-X=Y setting need to be applied
> > > to the command line so, for spapr capability error messages, this
> > > has been clarified to:
> > > 
> ...
> > > index bbb001f84a..1c0222a081 100644
> > > --- a/hw/ppc/spapr_caps.c
> > > +++ b/hw/ppc/spapr_caps.c
> > > @@ -37,6 +37,8 @@
> > >  
> > >  #include "hw/ppc/spapr.h"
> > >  
> > > +#define CAPABILITY_ERROR(X) "appending -machine " X  
> > 
> > I would make that:
> > 
> > #define CAPABILITY_HINT() "try appending -machine " X
> > 
> > because it is really an hint for the user, not an
> > error,
> 
> Works for me. At the lowest layer it is a hint.

Oh.. of course it is.  Which means we should be using the
error_append_hint() system that's for exactly this sort of
information.

Sorry I didn't think of that earlier.

> 
> > and all original strings have "try",
> 
> True.
> 
> > except...
> 
> 
> > > @@ -249,11 +255,13 @@ static void
> > > cap_safe_cache_apply(SpaprMachineState *spapr, uint8_t val, if
> > > (tcg_enabled() && val) { /* TCG only supports broken, allow other
> > > values and print a warning */ error_setg(&local_err,
> > > -                   "TCG doesn't support requested feature,
> > > cap-cfpc=%s",
> > > +                   "TCG doesn't support requested feature, "
> > > +                   CAPABILITY_ERROR("cap-cfpc=%s"),  
> > 
> > ... this one, but it doesn't look like a hint to me. It just tells
> > which is the unsupported cap.
> 
> This is one of 3 that local_error (commit
> 006e9d3618698eeef2f3e07628d22cb6f5c2a039) - intentionally just a
> warning and to TLDR the commit/Suraj conversation; defaults apply
> to all machine types; hardware security measures don't make sense in
> TCG; hence warning.
> 
> For every function with CAPABILITY_[ERROR|HINT] its called by
> spapr_caps_apply, has its errp as &error_fatal (intentionally - spoke
> to Suraj - migrations to machines without capabilities need to fail and
> defaults (kvm) should be secure unless explicitly disabled).
> 
> > >                     cap_cfpc_possible.vals[val]);
> > >      } else if (kvm_enabled() && (val > kvm_val)) {
> > >          error_setg(errp,
> > > -"Requested safe cache capability level not supported by kvm, try
> > > cap-cfpc=%s", +"Requested safe cache capability level not supported
> > > by kvm, try "
> > > +                   CAPABILITY_ERROR("cap-cfpc=%s"),
> > >                     cap_cfpc_possible.vals[kvm_val]);  
> > 
> > Also, we have a dedicated API for hints, which are only printed under
> > the monitor but ignored under QMP.
> 
> Ok.
>  
> > Not sure why it isn't used here but it should be something like:
> 
> If error_append_hint should be used for fatal errors (all that use
> errp), then this patten should be applied further to
> CAPABILITY_[HINT|ERROR] functions.
> 
> If error_append_hint needs to apply to warnings
> cap_[cfpc/sbbc/ibs]_apply functions need to use it.
> 
> Would I be right in I'm assuming that the below pattern needs to apply
> to both of these cases?
> 
> >         error_setg(errp, 
> >                    "Requested safe cache capability level not
> > supported by kvm");
> >         error_append_hint(errp,
> > CAPABILITY_HINT("cap-cfpc=%s") "\n", cap_cfpc_possible.vals[kvm_val]);
> 
> This is going a little beyond the scope of fixing a message, ok, but
> lets not extend the scope too much more.
> 

-- 
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 --]

      parent reply	other threads:[~2019-08-04  4:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01  3:38 [Qemu-devel] [PATCH v2] spapr: quantify error messages regarding capability settings Daniel Black
2019-08-01 10:41 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2019-08-02  1:03   ` Daniel Black
2019-08-02  9:49     ` Greg Kurz
2019-08-04  3:29     ` David Gibson [this message]

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=20190804032915.GC9535@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=daniel@linux.ibm.com \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).