mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
perf auxtrace: Fix multiple use of --itrace option
commitbb69c912c4
upstream. If the --itrace option is used more than once, the options are combined, but "i" and "y" (sub-)options can be corrupted because itrace_do_parse_synth_opts() incorrectly overwrites the period type and period with default values. For example, with: --itrace=i0ns --itrace=e The processing of "--itrace=e", resets the "i" period from 0 nanoseconds to the default 100 microseconds. Fix by performing the default setting of period type and period only if "i" or "y" are present in the currently processed --itrace value. Fixes:f6986c95af
("perf session: Add instruction tracing options") Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240315071334.3478-2-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
809a2ed171
commit
7063f15d2a
1 changed files with 3 additions and 1 deletions
|
@ -1466,6 +1466,7 @@ int itrace_do_parse_synth_opts(struct itrace_synth_opts *synth_opts,
|
|||
char *endptr;
|
||||
bool period_type_set = false;
|
||||
bool period_set = false;
|
||||
bool iy = false;
|
||||
|
||||
synth_opts->set = true;
|
||||
|
||||
|
@ -1484,6 +1485,7 @@ int itrace_do_parse_synth_opts(struct itrace_synth_opts *synth_opts,
|
|||
switch (*p++) {
|
||||
case 'i':
|
||||
case 'y':
|
||||
iy = true;
|
||||
if (p[-1] == 'y')
|
||||
synth_opts->cycles = true;
|
||||
else
|
||||
|
@ -1646,7 +1648,7 @@ int itrace_do_parse_synth_opts(struct itrace_synth_opts *synth_opts,
|
|||
}
|
||||
}
|
||||
out:
|
||||
if (synth_opts->instructions || synth_opts->cycles) {
|
||||
if (iy) {
|
||||
if (!period_type_set)
|
||||
synth_opts->period_type =
|
||||
PERF_ITRACE_DEFAULT_PERIOD_TYPE;
|
||||
|
|
Loading…
Reference in a new issue