aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/perf/util/bpf_lock_contention.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2022-11-18 11:01:09 -0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-11-23 10:42:28 -0300
commitc66a36af7ba3a628453da1d91f42ee64fb36ea5a (patch)
tree291fd932e31f1b2d3ea169601086258259dface7 /tools/perf/util/bpf_lock_contention.c
parentMAINTAINERS: Update John Garry's email address for arm64 perf tooling (diff)
downloadwireguard-linux-c66a36af7ba3a628453da1d91f42ee64fb36ea5a.tar.xz
wireguard-linux-c66a36af7ba3a628453da1d91f42ee64fb36ea5a.zip
perf lock contention: Do not use BPF task local storage
It caused some troubles when a lock inside kmalloc is contended because task local storage would allocate memory using kmalloc. It'd create a recusion and even crash in my system. There could be a couple of workarounds but I think the simplest one is to use a pre-allocated hash map. We could fix the task local storage to use the safe BPF allocator, but it takes time so let's change this until it happens actually. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Martin KaFai Lau <martin.lau@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Blake Jones <blakejones@google.com> Cc: Chris Li <chriscli@google.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <song@kernel.org> Cc: bpf@vger.kernel.org Link: https://lore.kernel.org/r/20221118190109.1512674-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/bpf_lock_contention.c')
-rw-r--r--tools/perf/util/bpf_lock_contention.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/util/bpf_lock_contention.c b/tools/perf/util/bpf_lock_contention.c
index 0deec1178778..4db9ad3d50c4 100644
--- a/tools/perf/util/bpf_lock_contention.c
+++ b/tools/perf/util/bpf_lock_contention.c
@@ -39,6 +39,7 @@ int lock_contention_prepare(struct lock_contention *con)
bpf_map__set_value_size(skel->maps.stacks, con->max_stack * sizeof(u64));
bpf_map__set_max_entries(skel->maps.stacks, con->map_nr_entries);
bpf_map__set_max_entries(skel->maps.lock_stat, con->map_nr_entries);
+ bpf_map__set_max_entries(skel->maps.tstamp, con->map_nr_entries);
if (target__has_cpu(target))
ncpus = perf_cpu_map__nr(evlist->core.user_requested_cpus);