Commit a827c007 authored by Like Xu's avatar Like Xu Committed by Arnaldo Carvalho de Melo

perf config: Refine error message to eliminate confusion

If there is no configuration file at first, the user can write any pair
of "key.subkey=value" to the newly created configuration file, while
value validation against a valid configurable key is *deferred* until
the next execution or the implied execution of "perf config ... ".

For example:

  $ rm ~/.perfconfig
  $ perf config call-graph.dump-size=65529
  $ cat ~/.perfconfig
  # this file is auto-generated.
  [call-graph]
 	dump-size = 65529
  $ perf config call-graph.dump-size=2048
  callchain: Incorrect stack dump size (max 65528): 65529
  Error: wrong config key-value pair call-graph.dump-size=65529

The user might expect that the second value 2048 is valid and can be
updated to the configuration file, but the error message is very
confusing because the first value 65529 is not reported as an error
during the last configuration.

It is recommended not to change the current behavior of delayed
validation (as more effort is needed), but to refine the original error
message to *clearly indicate* that the cause of the error is the
configuration file.
Signed-off-by: default avatarLike Xu <likexu@tencent.com>
Acked-by: default avatarIan Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210924115817.58689-1-likexu@tencent.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4da6552c
...@@ -801,7 +801,7 @@ int perf_config_set(struct perf_config_set *set, ...@@ -801,7 +801,7 @@ int perf_config_set(struct perf_config_set *set,
section->name, item->name); section->name, item->name);
ret = fn(key, value, data); ret = fn(key, value, data);
if (ret < 0) { if (ret < 0) {
pr_err("Error: wrong config key-value pair %s=%s\n", pr_err("Error in the given config file: wrong config key-value pair %s=%s\n",
key, value); key, value);
/* /*
* Can't be just a 'break', as perf_config_set__for_each_entry() * Can't be just a 'break', as perf_config_set__for_each_entry()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment