[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181105175604.GC7077@kernel.org>
Date: Mon, 5 Nov 2018 14:56:04 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Jiri Olsa <jolsa@...hat.com>, Andi Kleen <ak@...ux.intel.com>,
linux-kernel@...r.kernel.org, leo.yan@...aro.org,
David Miller <davem@...emloft.net>,
Mathieu Poirier <mathieu.poirier@...aro.org>
Subject: Re: [PATCH 3/5] perf tools: Use fallbacks for branch stacks
Em Wed, Oct 31, 2018 at 11:10:41AM +0200, Adrian Hunter escreveu:
> Branch stacks do not necessarily have the same cpumode as the 'ip'. Use the
> fallback functions in those cases.
>
> This patch depends on patch "perf tools: Add fallback functions for cases
>> where cpumode is insufficient".
This one is ok, i.e. only in places where we need a fallback we do it.
- Arnaldo
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> Cc: stable@...r.kernel.org # 4.19
> ---
> tools/perf/builtin-script.c | 12 ++++++------
> .../util/scripting-engines/trace-event-python.c | 16 ++++++++--------
> 2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index b5bc85bd0bbe..996317d8e183 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -728,8 +728,8 @@ static int perf_sample__fprintf_brstack(struct perf_sample *sample,
> if (PRINT_FIELD(DSO)) {
> memset(&alf, 0, sizeof(alf));
> memset(&alt, 0, sizeof(alt));
> - thread__find_map(thread, sample->cpumode, from, &alf);
> - thread__find_map(thread, sample->cpumode, to, &alt);
> + thread__find_map_fallback(thread, sample->cpumode, from, &alf);
> + thread__find_map_fallback(thread, sample->cpumode, to, &alt);
> }
>
> printed += fprintf(fp, " 0x%"PRIx64, from);
> @@ -775,8 +775,8 @@ static int perf_sample__fprintf_brstacksym(struct perf_sample *sample,
> from = br->entries[i].from;
> to = br->entries[i].to;
>
> - thread__find_symbol(thread, sample->cpumode, from, &alf);
> - thread__find_symbol(thread, sample->cpumode, to, &alt);
> + thread__find_symbol_fb(thread, sample->cpumode, from, &alf);
> + thread__find_symbol_fb(thread, sample->cpumode, to, &alt);
>
> printed += symbol__fprintf_symname_offs(alf.sym, &alf, fp);
> if (PRINT_FIELD(DSO)) {
> @@ -820,11 +820,11 @@ static int perf_sample__fprintf_brstackoff(struct perf_sample *sample,
> from = br->entries[i].from;
> to = br->entries[i].to;
>
> - if (thread__find_map(thread, sample->cpumode, from, &alf) &&
> + if (thread__find_map_fallback(thread, sample->cpumode, from, &alf) &&
> !alf.map->dso->adjust_symbols)
> from = map__map_ip(alf.map, from);
>
> - if (thread__find_map(thread, sample->cpumode, to, &alt) &&
> + if (thread__find_map_fallback(thread, sample->cpumode, to, &alt) &&
> !alt.map->dso->adjust_symbols)
> to = map__map_ip(alt.map, to);
>
> diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
> index 69aa93d4ee99..244aeeee9c7a 100644
> --- a/tools/perf/util/scripting-engines/trace-event-python.c
> +++ b/tools/perf/util/scripting-engines/trace-event-python.c
> @@ -494,14 +494,14 @@ static PyObject *python_process_brstack(struct perf_sample *sample,
> pydict_set_item_string_decref(pyelem, "cycles",
> PyLong_FromUnsignedLongLong(br->entries[i].flags.cycles));
>
> - thread__find_map(thread, sample->cpumode,
> - br->entries[i].from, &al);
> + thread__find_map_fallback(thread, sample->cpumode,
> + br->entries[i].from, &al);
> dsoname = get_dsoname(al.map);
> pydict_set_item_string_decref(pyelem, "from_dsoname",
> _PyUnicode_FromString(dsoname));
>
> - thread__find_map(thread, sample->cpumode,
> - br->entries[i].to, &al);
> + thread__find_map_fallback(thread, sample->cpumode,
> + br->entries[i].to, &al);
> dsoname = get_dsoname(al.map);
> pydict_set_item_string_decref(pyelem, "to_dsoname",
> _PyUnicode_FromString(dsoname));
> @@ -576,14 +576,14 @@ static PyObject *python_process_brstacksym(struct perf_sample *sample,
> if (!pyelem)
> Py_FatalError("couldn't create Python dictionary");
>
> - thread__find_symbol(thread, sample->cpumode,
> - br->entries[i].from, &al);
> + thread__find_symbol_fb(thread, sample->cpumode,
> + br->entries[i].from, &al);
> get_symoff(al.sym, &al, true, bf, sizeof(bf));
> pydict_set_item_string_decref(pyelem, "from",
> _PyUnicode_FromString(bf));
>
> - thread__find_symbol(thread, sample->cpumode,
> - br->entries[i].to, &al);
> + thread__find_symbol_fb(thread, sample->cpumode,
> + br->entries[i].to, &al);
> get_symoff(al.sym, &al, true, bf, sizeof(bf));
> pydict_set_item_string_decref(pyelem, "to",
> _PyUnicode_FromString(bf));
> --
> 2.17.1
Powered by blists - more mailing lists