Skip to content

Commit ee73fe9

Browse files
James-A-Clarkacmel
authored andcommitted
perf auxtrace: Allow number of queues to be specified
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@arm.com> Signed-off-by: James Clark <james.clark@arm.com> Tested-by: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steve Clevenger <scclevenger@os.amperecomputing.com> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20240429152207.479221-3-james.clark@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 0d2e3f2 commit ee73fe9

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

tools/perf/util/auxtrace.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,20 @@ static struct auxtrace_queue *auxtrace_alloc_queue_array(unsigned int nr_queues)
218218
return queue_array;
219219
}
220220

221-
int auxtrace_queues__init(struct auxtrace_queues *queues)
221+
int auxtrace_queues__init_nr(struct auxtrace_queues *queues, int nr_queues)
222222
{
223-
queues->nr_queues = AUXTRACE_INIT_NR_QUEUES;
223+
queues->nr_queues = nr_queues;
224224
queues->queue_array = auxtrace_alloc_queue_array(queues->nr_queues);
225225
if (!queues->queue_array)
226226
return -ENOMEM;
227227
return 0;
228228
}
229229

230+
int auxtrace_queues__init(struct auxtrace_queues *queues)
231+
{
232+
return auxtrace_queues__init_nr(queues, AUXTRACE_INIT_NR_QUEUES);
233+
}
234+
230235
static int auxtrace_queues__grow(struct auxtrace_queues *queues,
231236
unsigned int new_nr_queues)
232237
{

tools/perf/util/auxtrace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ int auxtrace_mmap__read_snapshot(struct mmap *map,
521521
struct perf_tool *tool, process_auxtrace_t fn,
522522
size_t snapshot_size);
523523

524+
int auxtrace_queues__init_nr(struct auxtrace_queues *queues, int nr_queues);
524525
int auxtrace_queues__init(struct auxtrace_queues *queues);
525526
int auxtrace_queues__add_event(struct auxtrace_queues *queues,
526527
struct perf_session *session,

0 commit comments

Comments
 (0)