linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] perf lock contention: Improve aggr x filter combination
@ 2023-02-03  2:13 Namhyung Kim
  2023-02-03  2:13 ` [PATCH v2 1/3] perf lock contention: Factor out lock_contention_get_name() Namhyung Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Namhyung Kim @ 2023-02-03  2:13 UTC (permalink / raw)
  To: acme, jolsa
  Cc: peterz, mingo, irogers, linux-kernel, adrian.hunter,
	linux-perf-users, song, haoluo, bpf, juri.lelli

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 (3):
  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

 tools/perf/builtin-lock.c                     |  79 ++++----
 tools/perf/util/Build                         |   5 +-
 tools/perf/util/bpf_lock_contention.c         | 180 +++++++++++-------
 .../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, 178 insertions(+), 110 deletions(-)

-- 
2.39.1.519.gcb327c4b5f-goog


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-03 20:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-03  2:13 [PATCH v2 0/3] perf lock contention: Improve aggr x filter combination Namhyung Kim
2023-02-03  2:13 ` [PATCH v2 1/3] perf lock contention: Factor out lock_contention_get_name() Namhyung Kim
2023-02-03  2:13 ` [PATCH v2 2/3] perf lock contention: Use lock_stat_find{,new} Namhyung Kim
2023-02-03  2:13 ` [PATCH v2 3/3] perf lock contention: Support filters for different aggregation Namhyung Kim
2023-02-03 20:12 ` [PATCH v2 0/3] perf lock contention: Improve aggr x filter combination Arnaldo Carvalho de Melo

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).