tools/perf/arch/arm64/util/arm-spe.c
Source file repositories/reference/linux-study-clean/tools/perf/arch/arm64/util/arm-spe.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/arch/arm64/util/arm-spe.c- Extension
.c- Size
- 18521 bytes
- Lines
- 695
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/types.hlinux/bitops.hlinux/log2.hlinux/string.hlinux/zalloc.herrno.htime.h../../../util/cpumap.h../../../util/event.h../../../util/evsel.h../../../util/evsel_config.h../../../util/evlist.h../../../util/session.hinternal/lib.h../../../util/pmu.h../../../util/debug.h../../../util/auxtrace.h../../../util/record.h../../../util/header.h../../../util/arm-spe.htools/libc_compat.h
Detected Declarations
struct arm_spe_recordingfunction arm_spe_is_set_freqfunction list_for_each_entryfunction arm_spe_find_cpusfunction arm_spe_info_priv_sizefunction arm_spe_save_cpu_headerfunction arm_spe_info_fillfunction arm_spe_snapshot_resolve_auxtrace_defaultsfunction arm_spe_pmu__sample_periodfunction arm_spe_setup_evselfunction arm_spe_setup_aux_bufferfunction arm_spe_setup_tracking_eventfunction arm_spe_recording_optionsfunction evlist__for_each_entryfunction evlist__for_each_entry_safefunction arm_spe_parse_snapshot_optionsfunction arm_spe_snapshot_startfunction evlist__for_each_entryfunction arm_spe_snapshot_finishfunction evlist__for_each_entryfunction arm_spe_alloc_wrapped_arrayfunction arm_spe_buffer_has_wrappedfunction arm_spe_find_snapshotfunction arm_spe_referencefunction arm_spe_recording_freefunction arm_spe_pmu_default_config
Annotated Snippet
tracking_evsel->core.attr.context_switch = 1;
}
return 0;
}
static int arm_spe_recording_options(struct auxtrace_record *itr,
struct evlist *evlist,
struct record_opts *opts)
{
struct arm_spe_recording *sper =
container_of(itr, struct arm_spe_recording, itr);
struct evsel *evsel, *tmp;
struct perf_cpu_map *cpus = evlist->core.user_requested_cpus;
bool discard = false;
int err;
u64 discard_bit;
sper->evlist = evlist;
evlist__for_each_entry(evlist, evsel) {
if (evsel__is_aux_event(evsel)) {
if (!strstarts(evsel->pmu->name, ARM_SPE_PMU_NAME)) {
pr_err("Found unexpected auxtrace event: %s\n",
evsel->pmu->name);
return -EINVAL;
}
opts->full_auxtrace = true;
if (opts->user_freq != UINT_MAX ||
arm_spe_is_set_freq(evsel)) {
pr_err("Arm SPE: Frequency is not supported. "
"Set period with -c option or PMU parameter (-e %s/period=NUM/).\n",
evsel->pmu->name);
return -EINVAL;
}
}
}
if (!opts->full_auxtrace)
return 0;
evlist__for_each_entry_safe(evlist, tmp, evsel) {
if (evsel__is_aux_event(evsel)) {
arm_spe_setup_evsel(evsel, cpus);
if (!evsel__get_config_val(evsel, "discard", &discard_bit))
discard = !!discard_bit;
}
}
if (discard)
return 0;
err = arm_spe_setup_aux_buffer(opts);
if (err)
return err;
return arm_spe_setup_tracking_event(evlist, opts);
}
static int arm_spe_parse_snapshot_options(struct auxtrace_record *itr __maybe_unused,
struct record_opts *opts,
const char *str)
{
unsigned long long snapshot_size = 0;
char *endptr;
if (str) {
snapshot_size = strtoull(str, &endptr, 0);
if (*endptr || snapshot_size > SIZE_MAX)
return -1;
}
opts->auxtrace_snapshot_mode = true;
opts->auxtrace_snapshot_size = snapshot_size;
return 0;
}
static int arm_spe_snapshot_start(struct auxtrace_record *itr)
{
struct arm_spe_recording *ptr =
container_of(itr, struct arm_spe_recording, itr);
struct evsel *evsel;
int ret = -EINVAL;
evlist__for_each_entry(ptr->evlist, evsel) {
if (evsel__is_aux_event(evsel)) {
ret = evsel__disable(evsel);
if (ret < 0)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/bitops.h`, `linux/log2.h`, `linux/string.h`, `linux/zalloc.h`, `errno.h`, `time.h`.
- Detected declarations: `struct arm_spe_recording`, `function arm_spe_is_set_freq`, `function list_for_each_entry`, `function arm_spe_find_cpus`, `function arm_spe_info_priv_size`, `function arm_spe_save_cpu_header`, `function arm_spe_info_fill`, `function arm_spe_snapshot_resolve_auxtrace_defaults`, `function arm_spe_pmu__sample_period`, `function arm_spe_setup_evsel`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.