[SRU][N:gke][PATCH 059/106] perf auxtrace: Allow number of queues to be specified
Tim Whisonant
tim.whisonant at canonical.com
Mon Jul 21 16:21:42 UTC 2025
From: James Clark <james.clark at arm.com>
BugLink: https://bugs.launchpad.net/bugs/2117098
Currently it's only possible to initialize with the default number of
queues and then use auxtrace_queues__add_event() to grow the array.
But that's problematic if you don't have a real event to pass into that
function yet.
The queues hold a void *priv member to store custom state, and for
Coresight we want to create decoders upfront before receiving data, so
add a new function that allows pre-allocating queues.
One reason to do this is because we might need to store metadata (HW_ID
events) that effects other queues, but never actually receive auxtrace
data on that queue.
Reviewed-by: Anshuman Khandual <anshuman.khandual at arm.com>
Signed-off-by: James Clark <james.clark at arm.com>
Tested-by: Ganapatrao Kulkarni <gankulkarni at os.amperecomputing.com>
Acked-by: Adrian Hunter <adrian.hunter at intel.com>
Cc: Alexander Shishkin <alexander.shishkin at linux.intel.com>
Cc: Alexandre Torgue <alexandre.torgue at foss.st.com>
Cc: Ian Rogers <irogers at google.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Jiri Olsa <jolsa at kernel.org>
Cc: John Garry <john.g.garry at oracle.com>
Cc: Leo Yan <leo.yan at linux.dev>
Cc: Mark Rutland <mark.rutland at arm.com>
Cc: Maxime Coquelin <mcoquelin.stm32 at gmail.com>
Cc: Mike Leach <mike.leach at linaro.org>
Cc: Namhyung Kim <namhyung at kernel.org>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Steve Clevenger <scclevenger at os.amperecomputing.com>
Cc: Suzuki Poulouse <suzuki.poulose at arm.com>
Cc: Will Deacon <will at kernel.org>
Link: https://lore.kernel.org/r/20240429152207.479221-3-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme at redhat.com>
(cherry picked from commit ee73fe99f77b066afc5035727130a6b8016e64b6)
Signed-off-by: Tim Whisonant <tim.whisonant at canonical.com>
---
tools/perf/util/auxtrace.c | 9 +++++++--
tools/perf/util/auxtrace.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index ef314a5797e30..666951dd67355 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -218,15 +218,20 @@ static struct auxtrace_queue *auxtrace_alloc_queue_array(unsigned int nr_queues)
return queue_array;
}
-int auxtrace_queues__init(struct auxtrace_queues *queues)
+int auxtrace_queues__init_nr(struct auxtrace_queues *queues, int nr_queues)
{
- queues->nr_queues = AUXTRACE_INIT_NR_QUEUES;
+ queues->nr_queues = nr_queues;
queues->queue_array = auxtrace_alloc_queue_array(queues->nr_queues);
if (!queues->queue_array)
return -ENOMEM;
return 0;
}
+int auxtrace_queues__init(struct auxtrace_queues *queues)
+{
+ return auxtrace_queues__init_nr(queues, AUXTRACE_INIT_NR_QUEUES);
+}
+
static int auxtrace_queues__grow(struct auxtrace_queues *queues,
unsigned int new_nr_queues)
{
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
index 55702215a82d3..8a6ec9565835f 100644
--- a/tools/perf/util/auxtrace.h
+++ b/tools/perf/util/auxtrace.h
@@ -521,6 +521,7 @@ int auxtrace_mmap__read_snapshot(struct mmap *map,
struct perf_tool *tool, process_auxtrace_t fn,
size_t snapshot_size);
+int auxtrace_queues__init_nr(struct auxtrace_queues *queues, int nr_queues);
int auxtrace_queues__init(struct auxtrace_queues *queues);
int auxtrace_queues__add_event(struct auxtrace_queues *queues,
struct perf_session *session,
--
2.43.0
More information about the kernel-team
mailing list