[Qemu-devel] [PATCH v4] spapr: quantify error messages regarding capability settings

Daniel Black posted 1 patch 17 weeks ago
Test FreeBSD passed
Test docker-mingw@fedora passed
Test asan passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test s390x passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190812071044.30806-1-daniel@linux.ibm.com
Maintainers: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_caps.c | 42 ++++++++++++++++++++++++++++--------------
1 file changed, 28 insertions(+), 14 deletions(-)

[Qemu-devel] [PATCH v4] spapr: quantify error messages regarding capability settings

Posted by Daniel Black 17 weeks ago
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:

 appending -machine cap-X=Y

The wrong value messages have been left as is, as the user has found
the right location.

Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Daniel Black <daniel@linux.ibm.com>
---
v4 Message inline rather than macro. greppability nitpick accepted with
grace and the magic of %s/CAPABILITY_HINT("\([^"]*\)")/" try appending -machine \1"/g.
v3 Hint, and not all messages, (can't use error_append_hint on
error_fatal) from Greg Kurz
v2 Improved error message thanks David Gibson

Left the "appending" as its not obvious more that one -machine
arguement is allowed.

 hw/ppc/spapr_caps.c | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
index bbb001f84a..405286db6f 100644
--- a/hw/ppc/spapr_caps.c
+++ b/hw/ppc/spapr_caps.c
@@ -194,10 +194,12 @@ static void cap_htm_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
     }
     if (tcg_enabled()) {
         error_setg(errp,
-                   "No Transactional Memory support in TCG, try cap-htm=off");
+                   "No Transactional Memory support in TCG,"
+                   " try appending -machine cap-htm=off");
     } else if (kvm_enabled() && !kvmppc_has_cap_htm()) {
         error_setg(errp,
-"KVM implementation does not support Transactional Memory, try cap-htm=off"
+"KVM implementation does not support Transactional Memory,"
+                   " try appending -machine cap-htm=off"
             );
     }
 }
@@ -215,7 +217,8 @@ static void cap_vsx_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
      * rid of anything that doesn't do VMX */
     g_assert(env->insns_flags & PPC_ALTIVEC);
     if (!(env->insns_flags2 & PPC2_VSX)) {
-        error_setg(errp, "VSX support not available, try cap-vsx=off");
+        error_setg(errp, "VSX support not available,"
+                   " try appending -machine cap-vsx=off");
     }
 }
 
@@ -229,7 +232,8 @@ static void cap_dfp_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
         return;
     }
     if (!(env->insns_flags2 & PPC2_DFP)) {
-        error_setg(errp, "DFP support not available, try cap-dfp=off");
+        error_setg(errp, "DFP support not available,"
+                   " try appending -machine cap-dfp=off");
     }
 }
 
@@ -253,7 +257,8 @@ static void cap_safe_cache_apply(SpaprMachineState *spapr, uint8_t val,
                    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 appending -machine cap-cfpc=%s",
                    cap_cfpc_possible.vals[kvm_val]);
     }
 
@@ -281,7 +286,8 @@ static void cap_safe_bounds_check_apply(SpaprMachineState *spapr, uint8_t val,
                    cap_sbbc_possible.vals[val]);
     } else if (kvm_enabled() && (val > kvm_val)) {
         error_setg(errp,
-"Requested safe bounds check capability level not supported by kvm, try cap-sbbc=%s",
+"Requested safe bounds check capability level not supported by kvm,"
+                   " try appending -machine cap-sbbc=%s",
                    cap_sbbc_possible.vals[kvm_val]);
     }
 
@@ -312,7 +318,8 @@ static void cap_safe_indirect_branch_apply(SpaprMachineState *spapr,
                    cap_ibs_possible.vals[val]);
     } else if (kvm_enabled() && (val > kvm_val)) {
         error_setg(errp,
-"Requested safe indirect branch capability level not supported by kvm, try cap-ibs=%s",
+"Requested safe indirect branch capability level not supported by kvm,"
+                   " try appending -machine cap-ibs=%s",
                    cap_ibs_possible.vals[kvm_val]);
     }
 
@@ -401,11 +408,13 @@ static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr,
 
     if (tcg_enabled()) {
         error_setg(errp,
-                   "No Nested KVM-HV support in tcg, try cap-nested-hv=off");
+                   "No Nested KVM-HV support in tcg,"
+                   " try appending -machine cap-nested-hv=off");
     } else if (kvm_enabled()) {
         if (!kvmppc_has_cap_nested_kvm_hv()) {
             error_setg(errp,
-"KVM implementation does not support Nested KVM-HV, try cap-nested-hv=off");
+"KVM implementation does not support Nested KVM-HV,"
+                       " try appending -machine cap-nested-hv=off");
         } else if (kvmppc_set_cap_nested_kvm_hv(val) < 0) {
                 error_setg(errp,
 "Error enabling cap-nested-hv with KVM, try cap-nested-hv=off");
@@ -435,10 +444,12 @@ static void cap_large_decr_apply(SpaprMachineState *spapr,
 
         if (!kvm_nr_bits) {
             error_setg(errp,
-                       "No large decrementer support, try cap-large-decr=off");
+                       "No large decrementer support,"
+                        " try appending -machine cap-large-decr=off");
         } else if (pcc->lrg_decr_bits != kvm_nr_bits) {
             error_setg(errp,
-"KVM large decrementer size (%d) differs to model (%d), try -cap-large-decr=off",
+"KVM large decrementer size (%d) differs to model (%d),"
+                " try appending -machine cap-large-decr=off",
                 kvm_nr_bits, pcc->lrg_decr_bits);
         }
     }
@@ -454,7 +465,8 @@ static void cap_large_decr_cpu_apply(SpaprMachineState *spapr,
     if (kvm_enabled()) {
         if (kvmppc_enable_cap_large_decr(cpu, val)) {
             error_setg(errp,
-                       "No large decrementer support, try cap-large-decr=off");
+                       "No large decrementer support,"
+                       " try appending -machine cap-large-decr=off");
         }
     }
 
@@ -474,10 +486,12 @@ static void cap_ccf_assist_apply(SpaprMachineState *spapr, uint8_t val,
     if (tcg_enabled() && val) {
         /* TODO - for now only allow broken for TCG */
         error_setg(errp,
-"Requested count cache flush assist capability level not supported by tcg, try cap-ccf-assist=off");
+"Requested count cache flush assist capability level not supported by tcg,"
+                   " try appending -machine cap-ccf-assist=off");
     } else if (kvm_enabled() && (val > kvm_val)) {
         error_setg(errp,
-"Requested count cache flush assist capability level not supported by kvm, try cap-ccf-assist=off");
+"Requested count cache flush assist capability level not supported by kvm,"
+                   " try appending -machine cap-ccf-assist=off");
     }
 }
 
-- 
2.21.0


Re: [Qemu-devel] [PATCH v4] spapr: quantify error messages regarding capability settings

Posted by David Gibson 17 weeks ago
On Mon, Aug 12, 2019 at 05:10:44PM +1000, Daniel Black 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:
> 
>  appending -machine cap-X=Y
> 
> The wrong value messages have been left as is, as the user has found
> the right location.

Applied to ppc-for-4.2.

> 
> Reviewed-by: Greg Kurz <groug@kaod.org>
> Signed-off-by: Daniel Black <daniel@linux.ibm.com>
> ---
> v4 Message inline rather than macro. greppability nitpick accepted with
> grace and the magic of %s/CAPABILITY_HINT("\([^"]*\)")/" try appending -machine \1"/g.
> v3 Hint, and not all messages, (can't use error_append_hint on
> error_fatal) from Greg Kurz
> v2 Improved error message thanks David Gibson
> 
> Left the "appending" as its not obvious more that one -machine
> arguement is allowed.
> 
>  hw/ppc/spapr_caps.c | 42 ++++++++++++++++++++++++++++--------------
>  1 file changed, 28 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
> index bbb001f84a..405286db6f 100644
> --- a/hw/ppc/spapr_caps.c
> +++ b/hw/ppc/spapr_caps.c
> @@ -194,10 +194,12 @@ static void cap_htm_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
>      }
>      if (tcg_enabled()) {
>          error_setg(errp,
> -                   "No Transactional Memory support in TCG, try cap-htm=off");
> +                   "No Transactional Memory support in TCG,"
> +                   " try appending -machine cap-htm=off");
>      } else if (kvm_enabled() && !kvmppc_has_cap_htm()) {
>          error_setg(errp,
> -"KVM implementation does not support Transactional Memory, try cap-htm=off"
> +"KVM implementation does not support Transactional Memory,"
> +                   " try appending -machine cap-htm=off"
>              );
>      }
>  }
> @@ -215,7 +217,8 @@ static void cap_vsx_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
>       * rid of anything that doesn't do VMX */
>      g_assert(env->insns_flags & PPC_ALTIVEC);
>      if (!(env->insns_flags2 & PPC2_VSX)) {
> -        error_setg(errp, "VSX support not available, try cap-vsx=off");
> +        error_setg(errp, "VSX support not available,"
> +                   " try appending -machine cap-vsx=off");
>      }
>  }
>  
> @@ -229,7 +232,8 @@ static void cap_dfp_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
>          return;
>      }
>      if (!(env->insns_flags2 & PPC2_DFP)) {
> -        error_setg(errp, "DFP support not available, try cap-dfp=off");
> +        error_setg(errp, "DFP support not available,"
> +                   " try appending -machine cap-dfp=off");
>      }
>  }
>  
> @@ -253,7 +257,8 @@ static void cap_safe_cache_apply(SpaprMachineState *spapr, uint8_t val,
>                     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 appending -machine cap-cfpc=%s",
>                     cap_cfpc_possible.vals[kvm_val]);
>      }
>  
> @@ -281,7 +286,8 @@ static void cap_safe_bounds_check_apply(SpaprMachineState *spapr, uint8_t val,
>                     cap_sbbc_possible.vals[val]);
>      } else if (kvm_enabled() && (val > kvm_val)) {
>          error_setg(errp,
> -"Requested safe bounds check capability level not supported by kvm, try cap-sbbc=%s",
> +"Requested safe bounds check capability level not supported by kvm,"
> +                   " try appending -machine cap-sbbc=%s",
>                     cap_sbbc_possible.vals[kvm_val]);
>      }
>  
> @@ -312,7 +318,8 @@ static void cap_safe_indirect_branch_apply(SpaprMachineState *spapr,
>                     cap_ibs_possible.vals[val]);
>      } else if (kvm_enabled() && (val > kvm_val)) {
>          error_setg(errp,
> -"Requested safe indirect branch capability level not supported by kvm, try cap-ibs=%s",
> +"Requested safe indirect branch capability level not supported by kvm,"
> +                   " try appending -machine cap-ibs=%s",
>                     cap_ibs_possible.vals[kvm_val]);
>      }
>  
> @@ -401,11 +408,13 @@ static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr,
>  
>      if (tcg_enabled()) {
>          error_setg(errp,
> -                   "No Nested KVM-HV support in tcg, try cap-nested-hv=off");
> +                   "No Nested KVM-HV support in tcg,"
> +                   " try appending -machine cap-nested-hv=off");
>      } else if (kvm_enabled()) {
>          if (!kvmppc_has_cap_nested_kvm_hv()) {
>              error_setg(errp,
> -"KVM implementation does not support Nested KVM-HV, try cap-nested-hv=off");
> +"KVM implementation does not support Nested KVM-HV,"
> +                       " try appending -machine cap-nested-hv=off");
>          } else if (kvmppc_set_cap_nested_kvm_hv(val) < 0) {
>                  error_setg(errp,
>  "Error enabling cap-nested-hv with KVM, try cap-nested-hv=off");
> @@ -435,10 +444,12 @@ static void cap_large_decr_apply(SpaprMachineState *spapr,
>  
>          if (!kvm_nr_bits) {
>              error_setg(errp,
> -                       "No large decrementer support, try cap-large-decr=off");
> +                       "No large decrementer support,"
> +                        " try appending -machine cap-large-decr=off");
>          } else if (pcc->lrg_decr_bits != kvm_nr_bits) {
>              error_setg(errp,
> -"KVM large decrementer size (%d) differs to model (%d), try -cap-large-decr=off",
> +"KVM large decrementer size (%d) differs to model (%d),"
> +                " try appending -machine cap-large-decr=off",
>                  kvm_nr_bits, pcc->lrg_decr_bits);
>          }
>      }
> @@ -454,7 +465,8 @@ static void cap_large_decr_cpu_apply(SpaprMachineState *spapr,
>      if (kvm_enabled()) {
>          if (kvmppc_enable_cap_large_decr(cpu, val)) {
>              error_setg(errp,
> -                       "No large decrementer support, try cap-large-decr=off");
> +                       "No large decrementer support,"
> +                       " try appending -machine cap-large-decr=off");
>          }
>      }
>  
> @@ -474,10 +486,12 @@ static void cap_ccf_assist_apply(SpaprMachineState *spapr, uint8_t val,
>      if (tcg_enabled() && val) {
>          /* TODO - for now only allow broken for TCG */
>          error_setg(errp,
> -"Requested count cache flush assist capability level not supported by tcg, try cap-ccf-assist=off");
> +"Requested count cache flush assist capability level not supported by tcg,"
> +                   " try appending -machine cap-ccf-assist=off");
>      } else if (kvm_enabled() && (val > kvm_val)) {
>          error_setg(errp,
> -"Requested count cache flush assist capability level not supported by kvm, try cap-ccf-assist=off");
> +"Requested count cache flush assist capability level not supported by kvm,"
> +                   " try appending -machine cap-ccf-assist=off");
>      }
>  }
>  

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