@@ -274,33 +274,9 @@ static void arm_spe_setup_evsel(struct evsel *evsel, struct perf_cpu_map *cpus)
274
274
evsel__set_sample_bit (evsel , PHYS_ADDR );
275
275
}
276
276
277
- static int arm_spe_recording_options (struct auxtrace_record * itr ,
278
- struct evlist * evlist ,
279
- struct record_opts * opts )
277
+ static int arm_spe_setup_aux_buffer (struct record_opts * opts )
280
278
{
281
- struct arm_spe_recording * sper =
282
- container_of (itr , struct arm_spe_recording , itr );
283
- struct evsel * evsel , * tmp ;
284
- struct perf_cpu_map * cpus = evlist -> core .user_requested_cpus ;
285
279
bool privileged = perf_event_paranoid_check (-1 );
286
- struct evsel * tracking_evsel ;
287
- int err ;
288
-
289
- sper -> evlist = evlist ;
290
-
291
- evlist__for_each_entry (evlist , evsel ) {
292
- if (evsel__is_aux_event (evsel )) {
293
- if (!strstarts (evsel -> pmu -> name , ARM_SPE_PMU_NAME )) {
294
- pr_err ("Found unexpected auxtrace event: %s\n" ,
295
- evsel -> pmu -> name );
296
- return - EINVAL ;
297
- }
298
- opts -> full_auxtrace = true;
299
- }
300
- }
301
-
302
- if (!opts -> full_auxtrace )
303
- return 0 ;
304
280
305
281
/*
306
282
* we are in snapshot mode.
@@ -330,6 +306,9 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
330
306
pr_err ("Failed to calculate default snapshot size and/or AUX area tracing mmap pages\n" );
331
307
return - EINVAL ;
332
308
}
309
+
310
+ pr_debug2 ("%sx snapshot size: %zu\n" , ARM_SPE_PMU_NAME ,
311
+ opts -> auxtrace_snapshot_size );
333
312
}
334
313
335
314
/* We are in full trace mode but '-m,xyz' wasn't specified */
@@ -355,14 +334,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
355
334
}
356
335
}
357
336
358
- if (opts -> auxtrace_snapshot_mode )
359
- pr_debug2 ("%sx snapshot size: %zu\n" , ARM_SPE_PMU_NAME ,
360
- opts -> auxtrace_snapshot_size );
337
+ return 0 ;
338
+ }
361
339
362
- evlist__for_each_entry_safe (evlist , tmp , evsel ) {
363
- if (evsel__is_aux_event (evsel ))
364
- arm_spe_setup_evsel (evsel , cpus );
365
- }
340
+ static int arm_spe_setup_tracking_event (struct evlist * evlist ,
341
+ struct record_opts * opts )
342
+ {
343
+ int err ;
344
+ struct evsel * tracking_evsel ;
345
+ struct perf_cpu_map * cpus = evlist -> core .user_requested_cpus ;
366
346
367
347
/* Add dummy event to keep tracking */
368
348
err = parse_event (evlist , "dummy:u" );
@@ -388,6 +368,45 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
388
368
return 0 ;
389
369
}
390
370
371
+ static int arm_spe_recording_options (struct auxtrace_record * itr ,
372
+ struct evlist * evlist ,
373
+ struct record_opts * opts )
374
+ {
375
+ struct arm_spe_recording * sper =
376
+ container_of (itr , struct arm_spe_recording , itr );
377
+ struct evsel * evsel , * tmp ;
378
+ struct perf_cpu_map * cpus = evlist -> core .user_requested_cpus ;
379
+
380
+ int err ;
381
+
382
+ sper -> evlist = evlist ;
383
+
384
+ evlist__for_each_entry (evlist , evsel ) {
385
+ if (evsel__is_aux_event (evsel )) {
386
+ if (!strstarts (evsel -> pmu -> name , ARM_SPE_PMU_NAME )) {
387
+ pr_err ("Found unexpected auxtrace event: %s\n" ,
388
+ evsel -> pmu -> name );
389
+ return - EINVAL ;
390
+ }
391
+ opts -> full_auxtrace = true;
392
+ }
393
+ }
394
+
395
+ if (!opts -> full_auxtrace )
396
+ return 0 ;
397
+
398
+ evlist__for_each_entry_safe (evlist , tmp , evsel ) {
399
+ if (evsel__is_aux_event (evsel ))
400
+ arm_spe_setup_evsel (evsel , cpus );
401
+ }
402
+
403
+ err = arm_spe_setup_aux_buffer (opts );
404
+ if (err )
405
+ return err ;
406
+
407
+ return arm_spe_setup_tracking_event (evlist , opts );
408
+ }
409
+
391
410
static int arm_spe_parse_snapshot_options (struct auxtrace_record * itr __maybe_unused ,
392
411
struct record_opts * opts ,
393
412
const char * str )
0 commit comments