arch/s390/kernel/perf_cpum_sf.c
Source file repositories/reference/linux-study-clean/arch/s390/kernel/perf_cpum_sf.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kernel/perf_cpum_sf.c- Extension
.c- Size
- 59832 bytes
- Lines
- 2108
- Domain
- Architecture Layer
- Bucket
- arch/s390
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/kernel_stat.hlinux/perf_event.hlinux/percpu.hlinux/pid.hlinux/notifier.hlinux/slab.hlinux/mm.hlinux/moduleparam.hasm/cpu_mf.hasm/irq.hasm/debug.hasm/timex.hlinux/io.h
Detected Declarations
struct sf_bufferstruct aux_bufferstruct cpu_hw_sffunction Authorfunction freq_to_sample_ratefunction sample_rate_to_freqfunction tablefunction sf_disablefunction sf_buffer_availablefunction free_sampling_bufferfunction alloc_sample_data_blockfunction realloc_sampling_bufferfunction allocate_sampling_bufferfunction sfb_set_limitsfunction sfb_max_limitfunction sfb_pending_allocsfunction sfb_account_allocsfunction sfb_init_allocsfunction deallocate_buffersfunction allocate_buffersfunction min_percentfunction compute_sfb_extentfunction sfb_account_overflowsfunction extend_sampling_bufferfunction setup_pmc_cpufunction release_pmc_hardwarefunction reserve_pmc_hardwarefunction hw_perf_event_destroyfunction hw_init_periodfunction hw_limit_ratefunction cpumsf_pid_typefunction cpumsf_output_event_pidfunction getratefunction perf_event_overflowfunction perf_adjust_periodfunction __hw_perf_event_initfunction for_each_online_cpufunction is_callchain_eventfunction cpumsf_pmu_event_initfunction cpumsf_pmu_enablefunction cpumsf_pmu_disablefunction perf_event_excludefunction perf_push_samplefunction perf_event_count_updatefunction hw_collect_samplesfunction hw_perf_event_updatefunction aux_sdb_indexfunction aux_sdb_num
Annotated Snippet
struct sf_buffer {
unsigned long *sdbt; /* Sample-data-block-table origin */
/* buffer characteristics (required for buffer increments) */
unsigned long num_sdb; /* Number of sample-data-blocks */
unsigned long num_sdbt; /* Number of sample-data-block-tables */
unsigned long *tail; /* last sample-data-block-table */
};
struct aux_buffer {
struct sf_buffer sfb;
unsigned long head; /* index of SDB of buffer head */
unsigned long alert_mark; /* index of SDB of alert request position */
unsigned long empty_mark; /* mark of SDB not marked full */
unsigned long *sdb_index; /* SDB address for fast lookup */
unsigned long *sdbt_index; /* SDBT address for fast lookup */
};
struct cpu_hw_sf {
/* CPU-measurement sampling information block */
struct hws_qsi_info_block qsi;
/* CPU-measurement sampling control block */
struct hws_lsctl_request_block lsctl;
struct sf_buffer sfb; /* Sampling buffer */
unsigned int flags; /* Status flags */
struct perf_event *event; /* Scheduled perf event */
struct perf_output_handle handle; /* AUX buffer output handle */
};
static DEFINE_PER_CPU(struct cpu_hw_sf, cpu_hw_sf);
/* Debug feature */
static debug_info_t *sfdbg;
/* Sampling control helper functions */
static inline unsigned long freq_to_sample_rate(struct hws_qsi_info_block *qsi,
unsigned long freq)
{
return (USEC_PER_SEC / freq) * qsi->cpu_speed;
}
static inline unsigned long sample_rate_to_freq(struct hws_qsi_info_block *qsi,
unsigned long rate)
{
return USEC_PER_SEC * qsi->cpu_speed / rate;
}
/* Return pointer to trailer entry of an sample data block */
static inline struct hws_trailer_entry *trailer_entry_ptr(unsigned long v)
{
void *ret;
ret = (void *)v;
ret += PAGE_SIZE;
ret -= sizeof(struct hws_trailer_entry);
return ret;
}
/*
* Return true if the entry in the sample data block table (sdbt)
* is a link to the next sdbt
*/
static inline int is_link_entry(unsigned long *s)
{
return *s & 0x1UL ? 1 : 0;
}
/* Return pointer to the linked sdbt */
static inline unsigned long *get_next_sdbt(unsigned long *s)
{
return phys_to_virt(*s & ~0x1UL);
}
/*
* sf_disable() - Switch off sampling facility
*/
static void sf_disable(void)
{
struct hws_lsctl_request_block sreq;
memset(&sreq, 0, sizeof(sreq));
lsctl(&sreq);
}
/*
* sf_buffer_available() - Check for an allocated sampling buffer
*/
static int sf_buffer_available(struct cpu_hw_sf *cpuhw)
{
return !!cpuhw->sfb.sdbt;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/kernel_stat.h`, `linux/perf_event.h`, `linux/percpu.h`, `linux/pid.h`, `linux/notifier.h`, `linux/slab.h`, `linux/mm.h`.
- Detected declarations: `struct sf_buffer`, `struct aux_buffer`, `struct cpu_hw_sf`, `function Author`, `function freq_to_sample_rate`, `function sample_rate_to_freq`, `function table`, `function sf_disable`, `function sf_buffer_available`, `function free_sampling_buffer`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.