arch/alpha/kernel/perf_event.c
Source file repositories/reference/linux-study-clean/arch/alpha/kernel/perf_event.c
File Facts
- System
- Linux kernel
- Corpus path
arch/alpha/kernel/perf_event.c- Extension
.c- Size
- 23094 bytes
- Lines
- 891
- Domain
- Architecture Layer
- Bucket
- arch/alpha
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/perf_event.hlinux/kprobes.hlinux/kernel.hlinux/kdebug.hlinux/mutex.hlinux/init.hasm/hwrpb.hlinux/atomic.hasm/irq.hasm/irq_regs.hasm/pal.hasm/wrperfmon.hasm/hw_irq.h
Detected Declarations
struct cpu_hw_eventsstruct alpha_pmu_tstruct ev67_mapping_tenum ev67_pmc_event_typefunction ev67_check_constraintsfunction ev67_raw_event_validfunction alpha_write_pmcfunction alpha_read_pmcfunction alpha_perf_event_set_periodfunction countfunction collect_eventsfunction alpha_check_constraintsfunction maybe_change_configurationfunction alpha_pmu_addfunction alpha_pmu_delfunction alpha_pmu_readfunction alpha_pmu_stopfunction alpha_pmu_startfunction supported_cpufunction hw_perf_event_destroyfunction __hw_perf_event_initfunction alpha_reserve_pmufunction alpha_pmu_event_initfunction alpha_pmu_enablefunction alpha_pmu_disablefunction perf_event_print_debugfunction alpha_perf_event_irq_handlerfunction init_hw_perf_events
Annotated Snippet
struct cpu_hw_events {
int enabled;
/* Number of events scheduled; also number entries valid in arrays below. */
int n_events;
/* Number events added since last hw_perf_disable(). */
int n_added;
/* Events currently scheduled. */
struct perf_event *event[MAX_HWEVENTS];
/* Event type of each scheduled event. */
unsigned long evtype[MAX_HWEVENTS];
/* Current index of each scheduled event; if not yet determined
* contains PMC_NO_INDEX.
*/
int current_idx[MAX_HWEVENTS];
/* The active PMCs' config for easy use with wrperfmon(). */
unsigned long config;
/* The active counters' indices for easy use with wrperfmon(). */
unsigned long idx_mask;
};
DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
/*
* A structure to hold the description of the PMCs available on a particular
* type of Alpha CPU.
*/
struct alpha_pmu_t {
/* Mapping of the perf system hw event types to indigenous event types */
const int *event_map;
/* The number of entries in the event_map */
int max_events;
/* The number of PMCs on this Alpha */
int num_pmcs;
/*
* All PMC counters reside in the IBOX register PCTR. This is the
* LSB of the counter.
*/
int pmc_count_shift[MAX_HWEVENTS];
/*
* The mask that isolates the PMC bits when the LSB of the counter
* is shifted to bit 0.
*/
unsigned long pmc_count_mask[MAX_HWEVENTS];
/* The maximum period the PMC can count. */
unsigned long pmc_max_period[MAX_HWEVENTS];
/*
* The maximum value that may be written to the counter due to
* hardware restrictions is pmc_max_period - pmc_left.
*/
long pmc_left[3];
/* Subroutine for allocation of PMCs. Enforces constraints. */
int (*check_constraints)(struct perf_event **, unsigned long *, int);
/* Subroutine for checking validity of a raw event for this PMU. */
int (*raw_event_valid)(u64 config);
};
/*
* The Alpha CPU PMU description currently in operation. This is set during
* the boot process to the specific CPU of the machine.
*/
static const struct alpha_pmu_t *alpha_pmu;
#define HW_OP_UNSUPPORTED -1
/*
* The hardware description of the EV67, EV68, EV69, EV7 and EV79 PMUs
* follow. Since they are identical we refer to them collectively as the
* EV67 henceforth.
*/
/*
* EV67 PMC event types
*
* There is no one-to-one mapping of the possible hw event types to the
* actual codes that are used to program the PMCs hence we introduce our
* own hw event type identifiers.
*/
enum ev67_pmc_event_type {
EV67_CYCLES = 1,
EV67_INSTRUCTIONS,
EV67_BCACHEMISS,
EV67_MBOXREPLAY,
EV67_LAST_ET
};
#define EV67_NUM_EVENT_TYPES (EV67_LAST_ET-EV67_CYCLES)
/* Mapping of the hw event types to the perf tool interface */
Annotation
- Immediate include surface: `linux/perf_event.h`, `linux/kprobes.h`, `linux/kernel.h`, `linux/kdebug.h`, `linux/mutex.h`, `linux/init.h`, `asm/hwrpb.h`, `linux/atomic.h`.
- Detected declarations: `struct cpu_hw_events`, `struct alpha_pmu_t`, `struct ev67_mapping_t`, `enum ev67_pmc_event_type`, `function ev67_check_constraints`, `function ev67_raw_event_valid`, `function alpha_write_pmc`, `function alpha_read_pmc`, `function alpha_perf_event_set_period`, `function count`.
- Atlas domain: Architecture Layer / arch/alpha.
- Implementation status: source implementation candidate.
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.