From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Subject: [PATCHSET 0/9] perf annotate-data: Update data-type profiling quality (v1)
Date: Fri, 16 Aug 2024 16:58:30 -0700 [thread overview]
Message-ID: <20240816235840.2754937-1-namhyung@kernel.org> (raw)
Hello,
I've found a couple of bugs in the DWARF location handling and had
some updates to improve the quality of the type resolution.
The current code only checks the first variable it found in the
closest scope but sometimes it's not good because macro expansions
like container_of (which is used by many list/rb tree manipulation
routines) only gives a very limited information (like void *) with
type cast. So it needs to lookup other variables in the upper scope.
See the patch 8 for more details.
Also sometimes it can have more information for the parent type if the
pointer is for an embedded type. For example, a list_head is
typically a part of bigger struct. Even if it found a variable for
the list_head, it'd be nice if it can tell which list it is.
To compare two type information in general, I've added a heuristic to
take a pointer to a bigger data type.
This is an example data, the portion of unknown type went down a bit
and the atomic_t turned out to be _mapcount in the struct page.
Before:
#
# Overhead Data Type
# ........ .........
#
37.24% (unknown)
14.40% atomic_t
8.81% (stack operation)
5.54% struct psi_group_cpu
3.40% struct task_struct
2.99% struct pcpu_hot
2.99% struct cfs_rq
2.18% struct audit_krule
1.93% struct psi_group
1.62% struct sched_entity
After:
#
# Overhead Data Type
# ........ .........
#
36.87% (unknown)
14.40% struct page
8.81% (stack operation)
6.00% struct psi_group_cpu
3.40% struct task_struct
3.36% struct cfs_rq
2.99% struct pcpu_hot
2.18% struct audit_krule
1.93% struct psi_group
1.62% struct sched_entity
Also updated the debug message and the statistics to help debugging.
The code is available at 'perf/data-profile-update-v1' branch in
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
Thanks,
Namhyung
Namhyung Kim (9):
perf dwarf-aux: Check allowed location expressions when collecting
variables
perf annotate-data: Fix off-by-one in location range check
perf annotate-data: Add enum type_match_result
perf annotate-data: Add variable_state_str()
perf annotate-data: Change return type of find_data_type_block()
perf annotate-data: Add is_pointer_type() helper
perf annotate-data: Add is_better_type() helper
perf annotate-data: Check variables in every scope
perf annotate-data: Update type stat at the end of
find_data_type_die()
tools/perf/util/annotate-data.c | 359 ++++++++++++++++++++------------
tools/perf/util/dwarf-aux.c | 5 +-
2 files changed, 230 insertions(+), 134 deletions(-)
--
2.46.0.184.g6999bdac58-goog
next reply other threads:[~2024-08-16 23:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 23:58 Namhyung Kim [this message]
2024-08-16 23:58 ` [PATCH 1/9] perf dwarf-aux: Check allowed location expressions when collecting variables Namhyung Kim
2024-08-17 16:24 ` Masami Hiramatsu
2024-08-16 23:58 ` [PATCH 2/9] perf annotate-data: Fix off-by-one in location range check Namhyung Kim
2024-08-18 13:22 ` Masami Hiramatsu
2024-08-16 23:58 ` [PATCH 3/9] perf annotate-data: Add enum type_match_result Namhyung Kim
2024-08-16 23:58 ` [PATCH 4/9] perf annotate-data: Add variable_state_str() Namhyung Kim
2024-08-16 23:58 ` [PATCH 5/9] perf annotate-data: Change return type of find_data_type_block() Namhyung Kim
2024-08-16 23:58 ` [PATCH 6/9] perf annotate-data: Add is_pointer_type() helper Namhyung Kim
2024-08-16 23:58 ` [PATCH 7/9] perf annotate-data: Add is_better_type() helper Namhyung Kim
2024-08-16 23:58 ` [PATCH 8/9] perf annotate-data: Check variables in every scope Namhyung Kim
2024-08-16 23:58 ` [PATCH 9/9] perf annotate-data: Update type stat at the end of find_data_type_die() Namhyung Kim
2024-08-19 19:35 ` [PATCHSET 0/9] perf annotate-data: Update data-type profiling quality (v1) Arnaldo Carvalho de Melo
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=20240816235840.2754937-1-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®