Skip to content

perf hashmap: Separate perf's hashmap code from libbpf

Ian Rogers bpf linux-perf-users lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4perf build: Don't check difference of perf and libbpf hashmaptools/perf/check-headers.sh+0 -40 replies
2/4perf hashmap: Rename hashmap to perf_hashmap to avoid libbpf conflicttools/perf/builtin-ftrace.c tools/perf/builtin-trace.c tools/perf/tests/expr.c +24 more+344 -3530 replies
3/4perf hashmap: Fix strict aliasing violations in hashmaptools/perf/util/hashmap.c tools/perf/util/hashmap.h+15 -140 replies
4/4perf hashmap: Remove errptr usage from hashmaptools/perf/builtin-trace.c tools/perf/ui/browsers/annotate.c tools/perf/util/expr.c +5 more+25 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] perf hashmap: Separate perf's hashmap code from libbpf

The hashmap code as-is violates the C specification meaning
-fno-strict-aliasing is required or fixes sent in:
https://lore.kernel.org/lkml/[email protected]/

We're looking to not build perf with -fno-strict-aliasing:
https://lore.kernel.org/lkml/[email protected]/

There is also the continual problem with hashmap using errptrs rather than errno introducing subtle bugs as shown in commits,
d05073adda0f perf trace: Avoid an ERR_PTR in syscall_stats 96f202eab813 perf trace: Fix IS_ERR() vs NULL check bug 9f3c16a430e8 perf expr: Fix return value of ids__new()
but there are additional fixes on the mailing list.
https://lore.kernel.org/lkml/[email protected]/

Allow the perf version of hashmap diverge from libbpf's so that we can fix its issues. This means that perf has a dependency on libbpf that has strict aliasing violations, no -fno-strict-alias or the fixes, but you can bring a horse to water, you can't make it drink.

v1: https://lore.kernel.org/lkml/[email protected]/

Ian Rogers (4):
perf build: Don't check difference of perf and libbpf hashmap perf hashmap: Rename hashmap to perf_hashmap to avoid libbpf conflict perf hashmap: Fix strict aliasing violations in hashmap perf hashmap: Remove errptr usage from hashmap

 tools/perf/builtin-ftrace.c           |  20 ++--
 tools/perf/builtin-trace.c            |  32 +++---
 tools/perf/check-headers.sh           |   4 -
 tools/perf/tests/expr.c               |  68 ++++++-------
 tools/perf/tests/pmu-events.c         |   8 +-
 tools/perf/ui/browsers/annotate.c     |  16 +--
 tools/perf/util/Build                 |   9 --
 tools/perf/util/annotate.c            |  18 ++--
 tools/perf/util/annotate.h            |   6 +-
 tools/perf/util/bpf-trace-summary.c   |  30 +++---
 tools/perf/util/bpf_lock_contention.c |  14 +--
 tools/perf/util/evsel.c               |   8 +-
 tools/perf/util/evsel.h               |   4 +-
 tools/perf/util/expr.c                |  68 ++++++-------
 tools/perf/util/expr.h                |  12 +--
 tools/perf/util/expr.y                |   2 +-
 tools/perf/util/fncache.c             |  16 +--
 tools/perf/util/ftrace.h              |   2 +-
 tools/perf/util/hashmap.c             | 126 +++++++++++------------
 tools/perf/util/hashmap.h             | 138 +++++++++++++-------------
 tools/perf/util/hwmon_pmu.c           |  44 ++++----
 tools/perf/util/metricgroup.c         |  30 +++---
 tools/perf/util/pmu.c                 |  30 +++---
 tools/perf/util/pmu.h                 |   4 +-
 tools/perf/util/s390-sample-raw.c     |  14 +--
 tools/perf/util/stat.c                |  10 +-
 tools/perf/util/threads.c             |  24 ++---
 tools/perf/util/threads.h             |   2 +-
 28 files changed, 379 insertions(+), 380 deletions(-)
Signature · 1 line
2.53.0.959.g497ff81fa9-goog