From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-perf-users@vger.kernel.org, Song Liu <song@kernel.org>,
Hao Luo <haoluo@google.com>,
bpf@vger.kernel.org
Subject: [PATCH 0/4] perf lock contention: Improve aggr x filter combination (v1)
Date: Wed, 1 Feb 2023 21:04:51 -0800 [thread overview]
Message-ID: <20230202050455.2187592-1-namhyung@kernel.org> (raw)
Hello,
The callstack filter can be useful to debug lock issues but it has a
limitation that it only works with caller aggregation mode (which is the
default setting). IOW it cannot filter by callstack when showing tasks
or lock addresses/names.
But sometimes users want to use the filter for other aggregation mode.
Like "show me lock addresses/names from this caller only" or "show me
tasks having these callers".
When it's using tracepoint events from the data file, the situation is
good since the tracepoints have all the necessary info. But when using
BPF it needs to extend the key of lock stat BPF map to have more than
one info like 'pid + stack_id' or 'lock_addr + stack_id'. As callstack
filter works in userspace, it should save the both info.
With this change we can now use the -S/--callstack-filter with the
-t/--threads option or -l/--lock-addr option. It's also possible to use
it with other filter options.
The following example shows the top 5 tasks that have contention
somewhere in the epoll handling.
$ sudo perf lock con -abt -S epoll -E5 -- sleep 1
contended total wait max wait avg wait pid comm
2 58.64 us 32.38 us 29.32 us 1514752 Chrome_IOThread
3 29.31 us 12.65 us 9.77 us 3773 Xorg
1 17.45 us 17.45 us 17.45 us 1514906 Chrome_ChildIOT
1 15.41 us 15.41 us 15.41 us 1515382 Chrome_ChildIOT
1 12.52 us 12.52 us 12.52 us 293878 IPC I/O Parent
You get get the code at 'perf/lock-filter-v1' branch in
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
Thanks,
Namhyung
Namhyung Kim (4):
perf lock contention: Factor out lock_contention_get_name()
perf lock contention: Use lock_stat_find{,new}
perf lock contention: Support filters for different aggregation
perf test: Add more test cases for perf lock contention
tools/perf/builtin-lock.c | 79 ++++----
tools/perf/tests/shell/lock_contention.sh | 66 ++++++-
tools/perf/util/bpf_lock_contention.c | 178 +++++++++++-------
.../perf/util/bpf_skel/lock_contention.bpf.c | 15 +-
tools/perf/util/bpf_skel/lock_data.h | 4 +-
tools/perf/util/lock-contention.h | 5 +
6 files changed, 234 insertions(+), 113 deletions(-)
base-commit: 7cfa9f5e440054db7c7e28e83a045d36993ff958
--
2.39.1.456.gfc5497dd1b-goog
next reply other threads:[~2023-02-02 5:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 5:04 Namhyung Kim [this message]
2023-02-02 5:04 ` [PATCH 1/4] perf lock contention: Factor out lock_contention_get_name() Namhyung Kim
2023-02-02 12:53 ` Arnaldo Carvalho de Melo
2023-02-02 5:04 ` [PATCH 2/4] perf lock contention: Use lock_stat_find{,new} Namhyung Kim
2023-02-02 20:27 ` Arnaldo Carvalho de Melo
2023-02-02 23:51 ` Namhyung Kim
2023-02-02 5:04 ` [PATCH 3/4] perf lock contention: Support filters for different aggregation Namhyung Kim
2023-02-02 5:04 ` [PATCH 4/4] perf test: Add more test cases for perf lock contention Namhyung Kim
2023-02-02 12:54 ` [PATCH 0/4] perf lock contention: Improve aggr x filter combination (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=20230202050455.2187592-1-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=bpf@vger.kernel.org \
--cc=haoluo@google.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=song@kernel.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;
as well as URLs for NNTP newsgroup(s).