perf hwmon_pmu: Hold path rather than fd
authorIan Rogers <irogers@google.com>
Tue, 24 Jun 2025 19:03:23 +0000 (12:03 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 3 Jul 2025 02:05:26 +0000 (19:05 -0700)
commitd1f18106778b4d1af5ca6bde191e05e075c7e697
tree82554e72dda6a057f6d0ab493810b77a541267c8
parent7a8557fc4aa12cffc97e5c8a1b8b8fd0275464b2
perf hwmon_pmu: Hold path rather than fd

Hold the path to the hwmon_pmu rather than the file descriptor. The
file descriptor is somewhat problematic in that it reflects the
directory state when opened, something that may vary in testing. Using
a path simplifies testing and to some extent cleanup as the hwmon_pmu
is owned by the pmus list and intentionally global and leaked when
perf terminates, the file descriptor being left open looks like a
leak.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250624190326.2038704-4-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/tests/hwmon_pmu.c
tools/perf/util/hwmon_pmu.c
tools/perf/util/hwmon_pmu.h
tools/perf/util/pmus.c
tools/perf/util/pmus.h