type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
functions | void
pfm_restore_monitoring(struct task_struct *task)
{
pfm_context_t *ctx = PFM_GET_CTX(task);
unsigned long mask, ovfl_mask;
unsigned long psr, val;
int i, is_system;
is_system = ctx->ctx_fl_system;
ovfl_mask = pmu_conf->ovfl_val;
if (task != current) {
printk(KERN_ERR "perfmon.%d: invalid task[%d] current... |
functions | void
pfm_save_pmds(unsigned long *pmds, unsigned long mask)
{
int i;
ia64_srlz_d();
for (i=0; mask; i++, mask>>=1) {
if (mask & 0x1) pmds[i] = ia64_get_pmd(i);
} |
functions | void
pfm_restore_pmds(unsigned long *pmds, unsigned long mask)
{
int i;
unsigned long val, ovfl_val = pmu_conf->ovfl_val;
for (i=0; mask; i++, mask>>=1) {
if ((mask & 0x1) == 0) continue;
val = PMD_IS_COUNTING(i) ? pmds[i] & ovfl_val : pmds[i];
ia64_set_pmd(i, val);
} |
functions | void
pfm_copy_pmds(struct task_struct *task, pfm_context_t *ctx)
{
unsigned long ovfl_val = pmu_conf->ovfl_val;
unsigned long mask = ctx->ctx_all_pmds[0];
unsigned long val;
int i;
DPRINT(("mask=0x%lx\n", mask));
for (i=0; mask; i++, mask>>=1) {
val = ctx->ctx_pmds[i].val;
/*
* We break up the 64 bit v... |
functions | void
pfm_copy_pmcs(struct task_struct *task, pfm_context_t *ctx)
{
unsigned long mask = ctx->ctx_all_pmcs[0];
int i;
DPRINT(("mask=0x%lx\n", mask));
for (i=0; mask; i++, mask>>=1) {
/* masking 0 with ovfl_val yields 0 */
ctx->th_pmcs[i] = ctx->ctx_pmcs[i];
DPRINT(("pmc[%d]=0x%lx\n", i, ctx->th_pmcs[i]));
} |
functions | void
pfm_restore_pmcs(unsigned long *pmcs, unsigned long mask)
{
int i;
for (i=0; mask; i++, mask>>=1) {
if ((mask & 0x1) == 0) continue;
ia64_set_pmc(i, pmcs[i]);
} |
functions | int
pfm_uuid_cmp(pfm_uuid_t a, pfm_uuid_t b)
{
return memcmp(a, b, sizeof(pfm_uuid_t));
} |
functions | int
pfm_buf_fmt_exit(pfm_buffer_fmt_t *fmt, struct task_struct *task, void *buf, struct pt_regs *regs)
{
int ret = 0;
if (fmt->fmt_exit) ret = (*fmt->fmt_exit)(task, buf, regs);
return ret;
} |
functions | int
pfm_buf_fmt_getsize(pfm_buffer_fmt_t *fmt, struct task_struct *task, unsigned int flags, int cpu, void *arg, unsigned long *size)
{
int ret = 0;
if (fmt->fmt_getsize) ret = (*fmt->fmt_getsize)(task, flags, cpu, arg, size);
return ret;
} |
functions | int
pfm_buf_fmt_validate(pfm_buffer_fmt_t *fmt, struct task_struct *task, unsigned int flags,
int cpu, void *arg)
{
int ret = 0;
if (fmt->fmt_validate) ret = (*fmt->fmt_validate)(task, flags, cpu, arg);
return ret;
} |
functions | int
pfm_buf_fmt_init(pfm_buffer_fmt_t *fmt, struct task_struct *task, void *buf, unsigned int flags,
int cpu, void *arg)
{
int ret = 0;
if (fmt->fmt_init) ret = (*fmt->fmt_init)(task, buf, flags, cpu, arg);
return ret;
} |
functions | int
pfm_buf_fmt_restart(pfm_buffer_fmt_t *fmt, struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs)
{
int ret = 0;
if (fmt->fmt_restart) ret = (*fmt->fmt_restart)(task, ctrl, buf, regs);
return ret;
} |
functions | int
pfm_buf_fmt_restart_active(pfm_buffer_fmt_t *fmt, struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs)
{
int ret = 0;
if (fmt->fmt_restart_active) ret = (*fmt->fmt_restart_active)(task, ctrl, buf, regs);
return ret;
} |
functions | int
pfm_register_buffer_fmt(pfm_buffer_fmt_t *fmt)
{
int ret = 0;
/* some sanity checks */
if (fmt == NULL || fmt->fmt_name == NULL) return -EINVAL;
/* we need at least a handler */
if (fmt->fmt_handler == NULL) return -EINVAL;
/*
* XXX: need check validity of fmt_arg_size
*/
spin_lock(&pfm_buffer_fmt_lo... |
functions | int
pfm_unregister_buffer_fmt(pfm_uuid_t uuid)
{
pfm_buffer_fmt_t *fmt;
int ret = 0;
spin_lock(&pfm_buffer_fmt_lock);
fmt = __pfm_find_buffer_fmt(uuid);
if (!fmt) {
printk(KERN_ERR "perfmon: cannot unregister format, not found\n");
ret = -EINVAL;
goto out;
} |
functions | int
pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
{
unsigned long flags;
/*
* validity checks on cpu_mask have been done upstream
*/
LOCK_PFS(flags);
DPRINT(("in sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
pfm_sessions.pfs_sys_sessions,
pfm_sessions.pf... |
functions | int
pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
{
unsigned long flags;
/*
* validity checks on cpu_mask have been done upstream
*/
LOCK_PFS(flags);
DPRINT(("in sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
pfm_sessions.pfs_sys_sessions,
pfm_sessions.pfs_ta... |
functions | int
pfm_remove_smpl_mapping(void *vaddr, unsigned long size)
{
struct task_struct *task = current;
int r;
/* sanity checks */
if (task->mm == NULL || size == 0UL || vaddr == NULL) {
printk(KERN_ERR "perfmon: pfm_remove_smpl_mapping [%d] invalid context mm=%p\n", task_pid_nr(task), task->mm);
return -EINVAL;
} |
functions | int
pfm_free_smpl_buffer(pfm_context_t *ctx)
{
pfm_buffer_fmt_t *fmt;
if (ctx->ctx_smpl_hdr == NULL) goto invalid_free;
/*
* we won't use the buffer format anymore
*/
fmt = ctx->ctx_buf_fmt;
DPRINT(("sampling buffer @%p size %lu vaddr=%p\n",
ctx->ctx_smpl_hdr,
ctx->ctx_smpl_size,
ctx->ctx_smpl_vaddr))... |
functions | void
pfm_exit_smpl_buffer(pfm_buffer_fmt_t *fmt)
{
if (fmt == NULL) return;
pfm_buf_fmt_exit(fmt, current, NULL, NULL);
} |
functions | __init
init_pfm_fs(void)
{
int err = register_filesystem(&pfm_fs_type);
if (!err) {
pfmfs_mnt = kern_mount(&pfm_fs_type);
err = PTR_ERR(pfmfs_mnt);
if (IS_ERR(pfmfs_mnt))
unregister_filesystem(&pfm_fs_type);
else
err = 0;
} |
functions | ssize_t
pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
{
pfm_context_t *ctx;
pfm_msg_t *msg;
ssize_t ret;
unsigned long flags;
DECLARE_WAITQUEUE(wait, current);
if (PFM_IS_FILE(filp) == 0) {
printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid_nr(current));
return -EINVA... |
functions | ssize_t
pfm_write(struct file *file, const char __user *ubuf,
size_t size, loff_t *ppos)
{
DPRINT(("pfm_write called\n"));
return -EINVAL;
} |
functions | int
pfm_poll(struct file *filp, poll_table * wait)
{
pfm_context_t *ctx;
unsigned long flags;
unsigned int mask = 0;
if (PFM_IS_FILE(filp) == 0) {
printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid_nr(current));
return 0;
} |
functions | long
pfm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
DPRINT(("pfm_ioctl called\n"));
return -EINVAL;
} |
functions | int
pfm_do_fasync(int fd, struct file *filp, pfm_context_t *ctx, int on)
{
int ret;
ret = fasync_helper (fd, filp, on, &ctx->ctx_async_queue);
DPRINT(("pfm_fasync called by [%d] on ctx_fd=%d on=%d async_queue=%p ret=%d\n",
task_pid_nr(current),
fd,
on,
ctx->ctx_async_queue, ret));
return ret;
} |
functions | int
pfm_fasync(int fd, struct file *filp, int on)
{
pfm_context_t *ctx;
int ret;
if (PFM_IS_FILE(filp) == 0) {
printk(KERN_ERR "perfmon: pfm_fasync bad magic [%d]\n", task_pid_nr(current));
return -EBADF;
} |
functions | void
pfm_syswide_force_stop(void *info)
{
pfm_context_t *ctx = (pfm_context_t *)info;
struct pt_regs *regs = task_pt_regs(current);
struct task_struct *owner;
unsigned long flags;
int ret;
if (ctx->ctx_cpu != smp_processor_id()) {
printk(KERN_ERR "perfmon: pfm_syswide_force_stop for CPU%d but on CPU%d\n",
... |
functions | void
pfm_syswide_cleanup_other_cpu(pfm_context_t *ctx)
{
int ret;
DPRINT(("calling CPU%d for cleanup\n", ctx->ctx_cpu));
ret = smp_call_function_single(ctx->ctx_cpu, pfm_syswide_force_stop, ctx, 1);
DPRINT(("called CPU%d for cleanup ret=%d\n", ctx->ctx_cpu, ret));
} |
functions | int
pfm_flush(struct file *filp, fl_owner_t id)
{
pfm_context_t *ctx;
struct task_struct *task;
struct pt_regs *regs;
unsigned long flags;
unsigned long smpl_buf_size = 0UL;
void *smpl_buf_vaddr = NULL;
int state, is_system;
if (PFM_IS_FILE(filp) == 0) {
DPRINT(("bad magic for\n"));
return -EBADF;
} |
functions | int
pfm_close(struct inode *inode, struct file *filp)
{
pfm_context_t *ctx;
struct task_struct *task;
struct pt_regs *regs;
DECLARE_WAITQUEUE(wait, current);
unsigned long flags;
unsigned long smpl_buf_size = 0UL;
void *smpl_buf_addr = NULL;
int free_possible = 1;
int state, is_system;
DPRINT(("pfm_close c... |
functions | else if (task != current) {
#ifdef CONFIG_SMP
/*
* switch context to zombie state
*/
ctx->ctx_state = PFM_CTX_ZOMBIE;
DPRINT(("zombie ctx for [%d]\n", task_pid_nr(task)));
/*
* cannot free the context on the spot. deferred until
* the task notices the ZOMBIE state
*/
free_possible = 0;
#else... |
functions | int
pfm_no_open(struct inode *irrelevant, struct file *dontcare)
{
DPRINT(("pfm_no_open called\n"));
return -ENXIO;
} |
functions | int
pfmfs_delete_dentry(const struct dentry *dentry)
{
return 1;
} |
functions | int
pfm_remap_buffer(struct vm_area_struct *vma, unsigned long buf, unsigned long addr, unsigned long size)
{
DPRINT(("CPU%d buf=0x%lx addr=0x%lx size=%ld\n", smp_processor_id(), buf, addr, size));
while (size > 0) {
unsigned long pfn = ia64_tpa(buf) >> PAGE_SHIFT;
if (remap_pfn_range(vma, addr, pfn, PAGE_SIZE... |
functions | int
pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t *ctx, unsigned long rsize, void **user_vaddr)
{
struct mm_struct *mm = task->mm;
struct vm_area_struct *vma = NULL;
unsigned long size;
void *smpl_buf;
/*
* the fixed header + requested size and align to page boundary
*/
si... |
functions | int
pfm_bad_permissions(struct task_struct *task)
{
const struct cred *tcred;
uid_t uid = current_uid();
gid_t gid = current_gid();
int ret;
rcu_read_lock();
tcred = __task_cred(task);
/* inspired by ptrace_attach() */
DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
uid,
gid,
... |
functions | int
pfarg_is_sane(struct task_struct *task, pfarg_context_t *pfx)
{
int ctx_flags;
/* valid signal */
ctx_flags = pfx->ctx_flags;
if (ctx_flags & PFM_FL_SYSTEM_WIDE) {
/*
* cannot block in this mode
*/
if (ctx_flags & PFM_FL_NOTIFY_BLOCK) {
DPRINT(("cannot use blocking mode when in system wide moni... |
functions | int
pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t *ctx, unsigned int ctx_flags,
unsigned int cpu, pfarg_context_t *arg)
{
pfm_buffer_fmt_t *fmt = NULL;
unsigned long size = 0UL;
void *uaddr = NULL;
void *fmt_arg = NULL;
int ret = 0;
/* invoke and lock buffer format, if f... |
functions | void
pfm_reset_pmu_state(pfm_context_t *ctx)
{
int i;
/*
* install reset values for PMC.
*/
for (i=1; PMC_IS_LAST(i) == 0; i++) {
if (PMC_IS_IMPL(i) == 0) continue;
ctx->ctx_pmcs[i] = PMC_DFL_VAL(i);
DPRINT(("pmc[%d]=0x%lx\n", i, ctx->ctx_pmcs[i]));
} |
functions | int
pfm_ctx_getsize(void *arg, size_t *sz)
{
pfarg_context_t *req = (pfarg_context_t *)arg;
pfm_buffer_fmt_t *fmt;
*sz = 0;
if (!pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) return 0;
fmt = pfm_find_buffer_fmt(req->ctx_smpl_buf_id);
if (fmt == NULL) {
DPRINT(("cannot find buffer format\n"));
return -... |
functions | int
pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task)
{
/*
* no kernel task or task not owner by caller
*/
if (task->mm == NULL) {
DPRINT(("task [%d] has not memory context (kernel thread)\n", task_pid_nr(task)));
return -EPERM;
} |
functions | int
pfm_get_task(pfm_context_t *ctx, pid_t pid, struct task_struct **task)
{
struct task_struct *p = current;
int ret;
/* XXX: need to add more checks here */
if (pid < 2) return -EPERM;
if (pid != task_pid_vnr(current)) {
read_lock(&tasklist_lock);
p = find_task_by_vpid(pid);
/* make sure task cannot g... |
functions | else if (p != current) {
pfm_put_task(p);
} |
functions | int
pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
pfarg_context_t *req = (pfarg_context_t *)arg;
struct file *filp;
struct path path;
int ctx_flags;
int fd;
int ret;
/* let's check the arguments first */
ret = pfarg_is_sane(current, req);
if (ret < 0)
return ret;
ctx... |
functions | long
pfm_new_counter_value (pfm_counter_t *reg, int is_long_reset)
{
unsigned long val = is_long_reset ? reg->long_reset : reg->short_reset;
unsigned long new_seed, old_seed = reg->seed, mask = reg->mask;
extern unsigned long carta_random32 (unsigned long seed);
if (reg->flags & PFM_REGFL_RANDOM) {
new_seed = ca... |
functions | void
pfm_reset_regs_masked(pfm_context_t *ctx, unsigned long *ovfl_regs, int is_long_reset)
{
unsigned long mask = ovfl_regs[0];
unsigned long reset_others = 0UL;
unsigned long val;
int i;
/*
* now restore reset value on sampling overflowed counters
*/
mask >>= PMU_FIRST_COUNTER;
for(i = PMU_FIRST_COUNTER; ... |
functions | void
pfm_reset_regs(pfm_context_t *ctx, unsigned long *ovfl_regs, int is_long_reset)
{
unsigned long mask = ovfl_regs[0];
unsigned long reset_others = 0UL;
unsigned long val;
int i;
DPRINT_ovfl(("ovfl_regs=0x%lx is_long_reset=%d\n", ovfl_regs[0], is_long_reset));
if (ctx->ctx_state == PFM_CTX_MASKED) {
pfm_re... |
functions | int
pfm_write_pmcs(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
pfarg_reg_t *req = (pfarg_reg_t *)arg;
unsigned long value, pmc_pm;
unsigned long smpl_pmds, reset_pmds, impl_pmds;
unsigned int cnum, reg_flags, flags, pmc_type;
int i, can_access_pmu = 0, is_loaded, is... |
functions | int
pfm_write_pmds(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
pfarg_reg_t *req = (pfarg_reg_t *)arg;
unsigned long value, hw_value, ovfl_mask;
unsigned int cnum;
int i, can_access_pmu = 0, state;
int is_counting, is_loaded, is_system, expert_mode;
int ret = -EINVA... |
functions | int
pfm_read_pmds(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
unsigned long val = 0UL, lval, ovfl_mask, sval;
pfarg_reg_t *req = (pfarg_reg_t *)arg;
unsigned int cnum, reg_flags = 0;
int i, can_access_pmu = 0, state;
int is_loaded, is_system, is_counting, expert_mod... |
functions | int
pfm_mod_write_pmcs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
{
pfm_context_t *ctx;
if (req == NULL) return -EINVAL;
ctx = GET_PMU_CTX();
if (ctx == NULL) return -EINVAL;
/*
* for now limit to current task, which is enough when calling
* from overflow handler
*/
i... |
functions | int
pfm_mod_read_pmds(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
{
pfm_context_t *ctx;
if (req == NULL) return -EINVAL;
ctx = GET_PMU_CTX();
if (ctx == NULL) return -EINVAL;
/*
* for now limit to current task, which is enough when calling
* from overflow handler
*/
if... |
functions | int
pfm_use_debug_registers(struct task_struct *task)
{
pfm_context_t *ctx = task->thread.pfm_context;
unsigned long flags;
int ret = 0;
if (pmu_conf->use_rr_dbregs == 0) return 0;
DPRINT(("called for [%d]\n", task_pid_nr(task)));
/*
* do it only once
*/
if (task->thread.flags & IA64_THREAD_DBG_VALID) ret... |
functions | int
pfm_release_debug_registers(struct task_struct *task)
{
unsigned long flags;
int ret;
if (pmu_conf->use_rr_dbregs == 0) return 0;
LOCK_PFS(flags);
if (pfm_sessions.pfs_ptrace_use_dbregs == 0) {
printk(KERN_ERR "perfmon: invalid release for [%d] ptrace_use_dbregs=0\n", task_pid_nr(task));
ret = -1;
} |
functions | int
pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
pfm_buffer_fmt_t *fmt;
pfm_ovfl_ctrl_t rst_ctrl;
int state, is_system;
int ret = 0;
state = ctx->ctx_state;
fmt = ctx->ctx_buf_fmt;
is_system = ctx->ctx_fl_system;
task = PFM_CTX_TASK(ctx... |
functions | int
pfm_debug(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
unsigned int m = *(unsigned int *)arg;
pfm_sysctl.debug = m == 0 ? 0 : 1;
printk(KERN_INFO "perfmon debugging %s (timing reset)\n", pfm_sysctl.debug ? "on" : "off");
if (m == 0) {
memset(pfm_stats, 0, sizeof(pfm_stats));
for(m=0;... |
functions | int
pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct thread_struct *thread = NULL;
struct task_struct *task;
pfarg_dbreg_t *req = (pfarg_dbreg_t *)arg;
unsigned long flags;
dbreg_t dbreg;
unsigned int rnum;
int first_time;
int ret = 0, state;
int i, can_acces... |
functions | int
pfm_write_ibrs(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
return pfm_write_ibr_dbr(PFM_CODE_RR, ctx, arg, count, regs);
} |
functions | int
pfm_write_dbrs(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
return pfm_write_ibr_dbr(PFM_DATA_RR, ctx, arg, count, regs);
} |
functions | int
pfm_mod_write_ibrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
{
pfm_context_t *ctx;
if (req == NULL) return -EINVAL;
ctx = GET_PMU_CTX();
if (ctx == NULL) return -EINVAL;
/*
* for now limit to current task, which is enough when calling
* from overflow handler
*/
i... |
functions | int
pfm_mod_write_dbrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
{
pfm_context_t *ctx;
if (req == NULL) return -EINVAL;
ctx = GET_PMU_CTX();
if (ctx == NULL) return -EINVAL;
/*
* for now limit to current task, which is enough when calling
* from overflow handler
*/
i... |
functions | int
pfm_get_features(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
pfarg_features_t *req = (pfarg_features_t *)arg;
req->ft_version = PFM_VERSION;
return 0;
} |
functions | int
pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct pt_regs *tregs;
struct task_struct *task = PFM_CTX_TASK(ctx);
int state, is_system;
state = ctx->ctx_state;
is_system = ctx->ctx_fl_system;
/*
* context must be attached to issue the stop command (includes LOADED,MASKED,... |
functions | int
pfm_start(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct pt_regs *tregs;
int state, is_system;
state = ctx->ctx_state;
is_system = ctx->ctx_fl_system;
if (state != PFM_CTX_LOADED) return -EINVAL;
/*
* In system wide and when the context is loaded, access can only happen
... |
functions | int
pfm_get_pmc_reset(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
pfarg_reg_t *req = (pfarg_reg_t *)arg;
unsigned int cnum;
int i;
int ret = -EINVAL;
for (i = 0; i < count; i++, req++) {
cnum = req->reg_num;
if (!PMC_IS_IMPL(cnum)) goto abort_mission;
req->reg_value = PMC_DFL_VAL(cn... |
functions | int
pfm_check_task_exist(pfm_context_t *ctx)
{
struct task_struct *g, *t;
int ret = -ESRCH;
read_lock(&tasklist_lock);
do_each_thread (g, t) {
if (t->thread.pfm_context == ctx) {
ret = 0;
goto out;
} |
functions | int
pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
struct thread_struct *thread;
struct pfm_context_t *old;
unsigned long flags;
#ifndef CONFIG_SMP
struct task_struct *owner_task = NULL;
#endif
pfarg_load_t *req = (pfarg_load_t *)arg;
unsigned long *p... |
functions | int
pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task = PFM_CTX_TASK(ctx);
struct pt_regs *tregs;
int prev_state, is_system;
int ret;
DPRINT(("ctx_state=%d task [%d]\n", ctx->ctx_state, task ? task_pid_nr(task) : -1));
prev_state = ctx->ctx_state;
is_... |
functions | void
pfm_exit_thread(struct task_struct *task)
{
pfm_context_t *ctx;
unsigned long flags;
struct pt_regs *regs = task_pt_regs(task);
int ret, state;
int free_ok = 0;
ctx = PFM_GET_CTX(task);
PROTECT_CTX(ctx, flags);
DPRINT(("state=%d task [%d]\n", ctx->ctx_state, task_pid_nr(task)));
state = ctx->ctx_state... |
functions | int
pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
{
struct task_struct *task;
int state, old_state;
recheck:
state = ctx->ctx_state;
task = ctx->ctx_task;
if (task == NULL) {
DPRINT(("context %d no task, state=%d\n", ctx->ctx_fd, state));
return 0;
} |
functions | long
sys_perfmonctl (int fd, int cmd, void __user *arg, int count)
{
struct file *file = NULL;
pfm_context_t *ctx = NULL;
unsigned long flags = 0UL;
void *args_k = NULL;
long ret; /* will expand int return types */
size_t base_sz, sz, xtra_sz = 0;
int narg, completed_args = 0, call_made = 0, cmd_flags;
int (*fu... |
functions | void
pfm_resume_after_ovfl(pfm_context_t *ctx, unsigned long ovfl_regs, struct pt_regs *regs)
{
pfm_buffer_fmt_t *fmt = ctx->ctx_buf_fmt;
pfm_ovfl_ctrl_t rst_ctrl;
int state;
int ret = 0;
state = ctx->ctx_state;
/*
* Unlock sampling buffer and reset index atomically
* XXX: not really needed when blocking
*... |
functions | void
pfm_context_force_terminate(pfm_context_t *ctx, struct pt_regs *regs)
{
int ret;
DPRINT(("entering for [%d]\n", task_pid_nr(current)));
ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) {
printk(KERN_ERR "pfm_context_force_terminate: [%d] unloaded failed with %d\n", task_pid_nr(current), ret);
} |
functions | void
pfm_handle_work(void)
{
pfm_context_t *ctx;
struct pt_regs *regs;
unsigned long flags, dummy_flags;
unsigned long ovfl_regs;
unsigned int reason;
int ret;
ctx = PFM_GET_CTX(current);
if (ctx == NULL) {
printk(KERN_ERR "perfmon: [%d] has no PFM context\n",
task_pid_nr(current));
return;
} |
functions | int
pfm_notify_user(pfm_context_t *ctx, pfm_msg_t *msg)
{
if (ctx->ctx_state == PFM_CTX_ZOMBIE) {
DPRINT(("ignoring overflow notification, owner is zombie\n"));
return 0;
} |
functions | int
pfm_ovfl_notify_user(pfm_context_t *ctx, unsigned long ovfl_pmds)
{
pfm_msg_t *msg = NULL;
if (ctx->ctx_fl_no_msg == 0) {
msg = pfm_get_new_msg(ctx);
if (msg == NULL) {
printk(KERN_ERR "perfmon: pfm_ovfl_notify_user no more notification msgs\n");
return -1;
} |
functions | int
pfm_end_notify_user(pfm_context_t *ctx)
{
pfm_msg_t *msg;
msg = pfm_get_new_msg(ctx);
if (msg == NULL) {
printk(KERN_ERR "perfmon: pfm_end_notify_user no more notification msgs\n");
return -1;
} |
functions | void pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx,
unsigned long pmc0, struct pt_regs *regs)
{
pfm_ovfl_arg_t *ovfl_arg;
unsigned long mask;
unsigned long old_val, ovfl_val, new_val;
unsigned long ovfl_notify = 0UL, ovfl_pmds = 0UL, smpl_pmds = 0UL, reset_pmds;
unsigned long tstamp;
pfm_o... |
functions | int
pfm_do_interrupt_handler(void *arg, struct pt_regs *regs)
{
struct task_struct *task;
pfm_context_t *ctx;
unsigned long flags;
u64 pmc0;
int this_cpu = smp_processor_id();
int retval = 0;
pfm_stats[this_cpu].pfm_ovfl_intr_count++;
/*
* srlz.d done before arriving here
*/
pmc0 = ia64_get_pmc(0);
tas... |
functions | irqreturn_t
pfm_interrupt_handler(int irq, void *arg)
{
unsigned long start_cycles, total_cycles;
unsigned long min, max;
int this_cpu;
int ret;
struct pt_regs *regs = get_irq_regs();
this_cpu = get_cpu();
if (likely(!pfm_alt_intr_handler)) {
min = pfm_stats[this_cpu].pfm_ovfl_intr_cycles_min;
max = pfm_sta... |
functions | void
pfm_proc_stop(struct seq_file *m, void *v)
{
} |
functions | void
pfm_proc_show_header(struct seq_file *m)
{
struct list_head * pos;
pfm_buffer_fmt_t * entry;
unsigned long flags;
seq_printf(m,
"perfmon version : %u.%u\n"
"model : %s\n"
"fastctxsw : %s\n"
"expert mode : %s\n"
"ovfl_mask :... |
functions | int
pfm_proc_show(struct seq_file *m, void *v)
{
unsigned long psr;
unsigned int i;
int cpu;
if (v == PFM_PROC_SHOW_HEADER) {
pfm_proc_show_header(m);
return 0;
} |
functions | int
pfm_proc_open(struct inode *inode, struct file *file)
{
return seq_open(file, &pfm_seq_ops);
} |
functions | void
pfm_syst_wide_update_task(struct task_struct *task, unsigned long info, int is_ctxswin)
{
struct pt_regs *regs;
unsigned long dcr;
unsigned long dcr_pp;
dcr_pp = info & PFM_CPUINFO_DCR_PP ? 1 : 0;
/*
* pid 0 is guaranteed to be the idle task. There is one such task with pid 0
* on every CPU, so we can r... |
functions | void
pfm_force_cleanup(pfm_context_t *ctx, struct pt_regs *regs)
{
struct task_struct *task = ctx->ctx_task;
ia64_psr(regs)->up = 0;
ia64_psr(regs)->sp = 1;
if (GET_PMU_OWNER() == task) {
DPRINT(("cleared ownership for [%d]\n",
task_pid_nr(ctx->ctx_task)));
SET_PMU_OWNER(NULL, NULL);
} |
functions | void
pfm_save_regs(struct task_struct *task)
{
pfm_context_t *ctx;
unsigned long flags;
u64 psr;
ctx = PFM_GET_CTX(task);
if (ctx == NULL) return;
/*
* we always come here with interrupts ALREADY disabled by
* the scheduler. So we simply need to protect against concurrent
* access, not CPU concurrency.... |
functions | void
pfm_save_regs(struct task_struct *task)
{
pfm_context_t *ctx;
u64 psr;
ctx = PFM_GET_CTX(task);
if (ctx == NULL) return;
/*
* save current PSR: needed because we modify it
*/
psr = pfm_get_psr();
BUG_ON(psr & (IA64_PSR_I));
/*
* stop monitoring:
* This is the last instruction which may generate... |
functions | void
pfm_lazy_save_regs (struct task_struct *task)
{
pfm_context_t *ctx;
unsigned long flags;
{ u64 psr = pfm_get_psr();
BUG_ON(psr & IA64_PSR_UP);
} |
functions | void
pfm_load_regs (struct task_struct *task)
{
pfm_context_t *ctx;
unsigned long pmc_mask = 0UL, pmd_mask = 0UL;
unsigned long flags;
u64 psr, psr_up;
int need_irq_resend;
ctx = PFM_GET_CTX(task);
if (unlikely(ctx == NULL)) return;
BUG_ON(GET_PMU_OWNER());
/*
* possible on unload
*/
if (unlikely((task... |
functions | void
pfm_load_regs (struct task_struct *task)
{
pfm_context_t *ctx;
struct task_struct *owner;
unsigned long pmd_mask, pmc_mask;
u64 psr, psr_up;
int need_irq_resend;
owner = GET_PMU_OWNER();
ctx = PFM_GET_CTX(task);
psr = pfm_get_psr();
BUG_ON(psr & (IA64_PSR_UP|IA64_PSR_PP));
BUG_ON(psr & IA64_PSR_I);... |
functions | void
pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx)
{
u64 pmc0;
unsigned long mask2, val, pmd_val, ovfl_val;
int i, can_access_pmu = 0;
int is_self;
/*
* is the caller the task being monitored (or which initiated the
* session for system wide measurements)
*/
is_self = ctx->ctx_task == task ?... |
functions | void
pfm_alt_save_pmu_state(void *data)
{
struct pt_regs *regs;
regs = task_pt_regs(current);
DPRINT(("called\n"));
/*
* should not be necessary but
* let's take not risk
*/
pfm_clear_psr_up();
pfm_clear_psr_pp();
ia64_psr(regs)->pp = 0;
/*
* This call is required
* May cause a spurious interrupt ... |
functions | void
pfm_alt_restore_pmu_state(void *data)
{
struct pt_regs *regs;
regs = task_pt_regs(current);
DPRINT(("called\n"));
/*
* put PMU back in state expected
* by perfmon
*/
pfm_clear_psr_up();
pfm_clear_psr_pp();
ia64_psr(regs)->pp = 0;
/*
* perfmon runs with PMU unfrozen at all times
*/
pfm_unfree... |
functions | int
pfm_install_alt_pmu_interrupt(pfm_intr_handler_desc_t *hdl)
{
int ret, i;
int reserve_cpu;
/* some sanity checks */
if (hdl == NULL || hdl->handler == NULL) return -EINVAL;
/* do the easy test first */
if (pfm_alt_intr_handler) return -EBUSY;
/* one at a time in the install or remove, just fail the others... |
functions | int
pfm_remove_alt_pmu_interrupt(pfm_intr_handler_desc_t *hdl)
{
int i;
int ret;
if (hdl == NULL) return -EINVAL;
/* cannot remove someone else's handler! */
if (pfm_alt_intr_handler != hdl) return -EINVAL;
/* one at a time in the install or remove, just fail the others */
if (!spin_trylock(&pfm_alt_install_c... |
functions | __init
pfm_probe_pmu(void)
{
pmu_config_t **p;
int family;
family = local_cpu_data->family;
p = pmu_confs;
while(*p) {
if ((*p)->probe) {
if ((*p)->probe() == 0) goto found;
} |
functions | __init
pfm_init(void)
{
unsigned int n, n_counters, i;
printk("perfmon: version %u.%u IRQ %u\n",
PFM_VERSION_MAJ,
PFM_VERSION_MIN,
IA64_PERFMON_VECTOR);
if (pfm_probe_pmu()) {
printk(KERN_INFO "perfmon: disabled, there is no support for processor family %d\n",
local_cpu_data->family);
return -ENODEV... |
functions | void
pfm_init_percpu (void)
{
static int first_time=1;
/*
* make sure no measurement is active
* (may inherit programmed PMCs from EFI).
*/
pfm_clear_psr_pp();
pfm_clear_psr_up();
/*
* we run with the PMU not frozen at all times
*/
pfm_unfreeze_pmu();
if (first_time) {
register_percpu_irq(IA64_PERF... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.