Lines Matching refs:task

328 …int			(*read_check)(struct task_struct *task, unsigned int cnum, unsigned long *val, struct pt_reg…
329 …int (*write_check)(struct task_struct *task, unsigned int cnum, unsigned long *val, struct pt_re…
362 …int (*cmd_func)(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, struct pt_reg…
731 pfm_remove_smpl_mapping(struct task_struct *task) in pfm_remove_smpl_mapping() argument
733 pfm_context_t *ctx = task->thread.pfm_context; in pfm_remove_smpl_mapping()
740 if (ctx == NULL || task->mm == NULL || ctx->ctx_smpl_vaddr == 0 || ctx->ctx_psb == NULL) { in pfm_remove_smpl_mapping()
741 printk(KERN_DEBUG "perfmon: invalid context mm=%p\n", task->mm); in pfm_remove_smpl_mapping()
746 down_write(&task->mm->mmap_sem); in pfm_remove_smpl_mapping()
748 r = do_munmap(task->mm, ctx->ctx_smpl_vaddr, psb->psb_size); in pfm_remove_smpl_mapping()
750 up_write(&task->mm->mmap_sem); in pfm_remove_smpl_mapping()
753 "@0x%lx size=%ld\n", task->pid, ctx->ctx_smpl_vaddr, psb->psb_size); in pfm_remove_smpl_mapping()
757 task->pid, ctx->ctx_smpl_vaddr, psb->psb_size, r, psb->psb_refcnt, psb->psb_flags)); in pfm_remove_smpl_mapping()
1000 pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned long cpu_mask) in pfm_reserve_session() argument
1030 pfm_sessions.pfs_sys_session[i] = task; in pfm_reserve_session()
1056 pfm_unreserve_session(struct task_struct *task, int is_syswide, unsigned long cpu_mask) in pfm_unreserve_session() argument
1062 ctx = task ? task->thread.pfm_context : NULL; in pfm_unreserve_session()
1070 task->pid, in pfm_unreserve_session()
1091 "sys_use_dbregs=0\n", task->pid); in pfm_unreserve_session()
1103 task->pid, pfm_sessions.pfs_task_sessions)); in pfm_unreserve_session()
1154 pfm_bad_permissions(struct task_struct *task) in pfm_bad_permissions() argument
1157 return (current->session != task->session) in pfm_bad_permissions()
1158 && (current->euid ^ task->suid) && (current->euid ^ task->uid) in pfm_bad_permissions()
1159 && (current->uid ^ task->suid) && (current->uid ^ task->uid); in pfm_bad_permissions()
1163 pfx_is_sane(struct task_struct *task, pfarg_context_t *pfx) in pfx_is_sane() argument
1210 if (task->cpus_allowed != ~0UL && (task->cpus_allowed & (1UL<<cpu)) == 0) { in pfx_is_sane()
1211 DBprintk(("[%d] pinned on 0x%lx, mask for CPU%d \n", task->pid, in pfx_is_sane()
1212 task->cpus_allowed, cpu)); in pfx_is_sane()
1222 DBprintk(("must have notify_pid when blocking for [%d]\n", task->pid)); in pfx_is_sane()
1226 if ((ctx_flags & PFM_FL_NOTIFY_BLOCK) && pfx->ctx_notify_pid == task->pid) { in pfx_is_sane()
1227 DBprintk(("cannot notify self when blocking for [%d]\n", task->pid)); in pfx_is_sane()
1243 pfm_context_create(struct task_struct *task, pfm_context_t *ctx, void *req, int count, in pfm_context_create() argument
1258 if (task != current) return -EINVAL; in pfm_context_create()
1262 ret = pfx_is_sane(task, &tmp); in pfm_context_create()
1267 ret = pfm_reserve_session(task, ctx_flags & PFM_FL_SYSTEM_WIDE, tmp.ctx_cpu_mask); in pfm_context_create()
1285 task->thread.pfm_context = ctx; in pfm_context_create()
1314 task->thread.pfm_context = ctx; in pfm_context_create()
1386 (void *)ctx, task->pid, ctx->ctx_notify_task)); in pfm_context_create()
1389 (void *)ctx, task->pid, ctx_flags, ctx->ctx_fl_inherit, in pfm_context_create()
1397 if (notify_pid == 0) task->thread.pfm_context = ctx; in pfm_context_create()
1404 ctx->ctx_saved_cpus_allowed = task->cpus_allowed; in pfm_context_create()
1405 task->cpus_allowed = tmp.ctx_cpu_mask; in pfm_context_create()
1406 task->need_resched = 1; in pfm_context_create()
1407 DBprintk(("[%d] rescheduled allowed=0x%lx\n", task->pid, task->cpus_allowed)); in pfm_context_create()
1415 pfm_unreserve_session(task, ctx_flags & PFM_FL_SYSTEM_WIDE , tmp.ctx_cpu_mask); in pfm_context_create()
1418 task->thread.pfm_context = NULL; in pfm_context_create()
1488 pfm_write_pmcs(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, struct pt_regs *… in pfm_write_pmcs() argument
1490 struct thread_struct *th = &task->thread; in pfm_write_pmcs()
1499 if (task != current) return -EINVAL; in pfm_write_pmcs()
1576 ret = PMC_WR_FUNC(cnum)(task, cnum, &value, regs); in pfm_write_pmcs()
1626 task->pid, cnum, value, in pfm_write_pmcs()
1639 DBprintk(("[%d] pmc[%u]=0x%lx error %d\n", task->pid, cnum, value, ret)); in pfm_write_pmcs()
1645 pfm_write_pmds(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, struct pt_regs *… in pfm_write_pmds() argument
1654 if (task != current) return -EINVAL; in pfm_write_pmds()
1681 ret = PMD_WR_FUNC(cnum)(task, cnum, &v, regs); in pfm_write_pmds()
1726 task->pid, cnum, in pfm_write_pmds()
1752 DBprintk(("[%d] pmc[%u]=0x%lx ret %d\n", task->pid, cnum, value, ret)); in pfm_write_pmds()
1758 pfm_read_pmds(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, struct pt_regs *r… in pfm_read_pmds() argument
1760 struct thread_struct *th = &task->thread; in pfm_read_pmds()
1770 DBprintk(("context for [%d] is disabled\n", task->pid)); in pfm_read_pmds()
1819 if (task == PMU_OWNER()) { in pfm_read_pmds()
1842 ret = PMD_RD_FUNC(cnum)(task, cnum, &v, regs); in pfm_read_pmds()
1880 pfm_use_debug_registers(struct task_struct *task) in pfm_use_debug_registers() argument
1882 pfm_context_t *ctx = task->thread.pfm_context; in pfm_use_debug_registers()
1885 DBprintk(("called for [%d]\n", task->pid)); in pfm_use_debug_registers()
1890 if (task->thread.flags & IA64_THREAD_DBG_VALID) return 0; in pfm_use_debug_registers()
1916 task->pid, ret)); in pfm_use_debug_registers()
1932 pfm_release_debug_registers(struct task_struct *task) in pfm_release_debug_registers() argument
1939 task->pid); in pfm_release_debug_registers()
1956 pfm_use_debug_registers(struct task_struct *task) in pfm_use_debug_registers() argument
1962 pfm_release_debug_registers(struct task_struct *task) in pfm_release_debug_registers() argument
1969 pfm_restart(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_restart() argument
1979 if (task == current) { in pfm_restart()
1981 task->pid, in pfm_restart()
2019 DBprintk(("unblocking %d \n", task->pid)); in pfm_restart()
2022 task->thread.pfm_ovfl_block_reset = 1; in pfm_restart()
2035 DBprintk(("resetting sampling indexes for %d \n", task->pid)); in pfm_restart()
2044 pfm_stop(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_stop() argument
2048 if (task != current) return -EINVAL; in pfm_stop()
2089 pfm_disable(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_disable() argument
2093 if (task != current) return -EINVAL; in pfm_disable()
2101 pfm_flush_regs(task); in pfm_disable()
2122 pfm_context_destroy(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_context_destroy() argument
2126 if (task != current) return -EINVAL; in pfm_context_destroy()
2140 pfm_disable(task, ctx, arg, count, regs); in pfm_context_destroy()
2153 pfm_remove_smpl_mapping(task); in pfm_context_destroy()
2157 pfm_context_exit(task); in pfm_context_destroy()
2166 pfm_context_unprotect(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_context_unprotect() argument
2173 pfm_protect_context(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_protect_context() argument
2186 DBprintk(("[%d] protected psr.sp=%d\n", task->pid, ia64_psr(regs)->sp)); in pfm_protect_context()
2192 pfm_debug(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_debug() argument
2229 pfm_write_ibr_dbr(int mode, struct task_struct *task, void *arg, int count, struct pt_regs *regs) in pfm_write_ibr_dbr() argument
2231 struct thread_struct *thread = &task->thread; in pfm_write_ibr_dbr()
2232 pfm_context_t *ctx = task->thread.pfm_context; in pfm_write_ibr_dbr()
2264 DBprintk(("system-wide setting fl_using_dbreg for [%d]\n", task->pid)); in pfm_write_ibr_dbr()
2268 DBprintk(("debug registers already in use for [%d]\n", task->pid)); in pfm_write_ibr_dbr()
2274 DBprintk(("setting fl_using_dbreg for [%d]\n", task->pid)); in pfm_write_ibr_dbr()
2280 memset(task->thread.dbr, 0, sizeof(task->thread.dbr)); in pfm_write_ibr_dbr()
2281 memset(task->thread.ibr, 0, sizeof(task->thread.ibr)); in pfm_write_ibr_dbr()
2285 DBprintk(("[%d] clearing ibrs,dbrs\n", task->pid)); in pfm_write_ibr_dbr()
2406 pfm_write_ibrs(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_write_ibrs() argument
2410 if (task != current) return -EINVAL; in pfm_write_ibrs()
2414 return pfm_write_ibr_dbr(0, task, arg, count, regs); in pfm_write_ibrs()
2418 pfm_write_dbrs(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_write_dbrs() argument
2422 if (task != current) return -EINVAL; in pfm_write_dbrs()
2426 return pfm_write_ibr_dbr(1, task, arg, count, regs); in pfm_write_dbrs()
2432 pfm_get_features(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, struct pt_regs… in pfm_get_features() argument
2447 pfm_start(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_start() argument
2451 if (task != current) return -EINVAL; in pfm_start()
2463 if (PMU_OWNER() != task) { in pfm_start()
2464 printk(KERN_DEBUG "perfmon: pfm_start task [%d] not pmu owner\n", task->pid); in pfm_start()
2484 if ((task->thread.flags & IA64_THREAD_PM_VALID) == 0) { in pfm_start()
2486 task->pid); in pfm_start()
2502 pfm_enable(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_enable() argument
2506 if (task != current) { in pfm_enable()
2507 DBprintk(("task [%d] != current [%d]\n", task->pid, current->pid)); in pfm_enable()
2517 pfm_reset_pmu(task); in pfm_enable()
2550 task->thread.flags |= IA64_THREAD_PM_VALID; in pfm_enable()
2553 SET_PMU_OWNER(task); in pfm_enable()
2567 pfm_get_pmc_reset(struct task_struct *task, pfm_context_t *ctx, void *arg, int count, in pfm_get_pmc_reset() argument
2642 check_task_state(struct task_struct *task) in check_task_state() argument
2653 task_lock(task); in check_task_state()
2654 DBprintk((" [%d] state=%ld\n", task->pid, task->state)); in check_task_state()
2655 if (!task_has_cpu(task)) break; in check_task_state()
2656 task_unlock(task); in check_task_state()
2659 if (task->state != TASK_ZOMBIE && task->state != TASK_STOPPED) { in check_task_state()
2660 DBprintk(("warning [%d] not in stable state %ld\n", task->pid, task->state)); in check_task_state()
2665 } while (task_has_cpu(task)); in check_task_state()
2667 task_unlock(task); in check_task_state()
2669 if (task->state != TASK_ZOMBIE && task->state != TASK_STOPPED) { in check_task_state()
2670 DBprintk(("warning [%d] not in stable state %ld\n", task->pid, task->state)); in check_task_state()
2682 struct task_struct *task = current; in sys_perfmonctl() local
2720 task = find_task_by_pid(pid); in sys_perfmonctl()
2722 if (!task) goto abort_call; in sys_perfmonctl()
2726 if (pfm_bad_permissions(task)) goto abort_call; in sys_perfmonctl()
2729 ret = check_task_state(task); in sys_perfmonctl()
2731 DBprintk(("check_task_state=%ld for [%d]\n", ret, task->pid)); in sys_perfmonctl()
2738 ctx = PFM_GET_CTX(task); in sys_perfmonctl()
2743 DBprintk(("no context for task %d\n", task->pid)); in sys_perfmonctl()
2755 if (ctx->ctx_owner != current && (ctx->ctx_fl_protected || task != current)) { in sys_perfmonctl()
2756 DBprintk(("context protected, no access for [%d]\n", task->pid)); in sys_perfmonctl()
2761 ret = (*pfm_cmd_tab[PFM_CMD_IDX(cmd)].cmd_func)(task, ctx, arg, count, regs); in sys_perfmonctl()
2764 if (task != current) read_unlock(&tasklist_lock); in sys_perfmonctl()
2844 pfm_record_sample(struct task_struct *task, pfm_context_t *ctx, unsigned long ovfl_mask, struct pt_… in pfm_record_sample() argument
2872 h->pid = ctx->ctx_fl_system ? current->pid : task->pid; in pfm_record_sample()
2930 pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, struct pt_regs *regs) in pfm_overflow_handler() argument
2951 t = &task->thread; in pfm_overflow_handler()
2959 "using perfmon\n", task->pid); in pfm_overflow_handler()
2967 task->pid, pmc0); in pfm_overflow_handler()
2975 pmc0, task->pid, (regs ? regs->cr_iip : 0), in pfm_overflow_handler()
3029 ret = pfm_record_sample(task, ctx, ovfl_pmds, regs); in pfm_overflow_handler()
3078 if (CTX_OVFL_NOBLOCK(ctx) == 0 && ctx->ctx_notify_task != task) { in pfm_overflow_handler()
3109 struct task_struct *task; in pfm_interrupt_handler() local
3128 task = PMU_OWNER(); in pfm_interrupt_handler()
3133 if (PMC0_HAS_OVFL(pmc0) && task) { in pfm_interrupt_handler()
3137 ctx = PFM_GET_CTX(task); in pfm_interrupt_handler()
3142 "no PFM context\n", task->pid); in pfm_interrupt_handler()
3148 pmc0 = pfm_overflow_handler(task, ctx, pmc0, regs); in pfm_interrupt_handler()
3157 if (task == current || ctx->ctx_fl_system) { in pfm_interrupt_handler()
3165 task->thread.pmc[0] = pmc0; in pfm_interrupt_handler()
3284 pfm_syst_wide_update_task(struct task_struct *task, unsigned long info, int is_ctxswin) in pfm_syst_wide_update_task() argument
3296 if ((info & PFM_CPUINFO_EXCL_IDLE) == 0 || task->pid) { in pfm_syst_wide_update_task()
3297 regs = (struct pt_regs *)((unsigned long) task + IA64_STK_OFFSET); in pfm_syst_wide_update_task()
3334 pfm_save_regs(struct task_struct *task) in pfm_save_regs() argument
3340 ctx = PFM_GET_CTX(task); in pfm_save_regs()
3342 t = &task->thread; in pfm_save_regs()
3395 smp_processor_id(), task->pid, in pfm_save_regs()
3396 task->thread.flags & IA64_THREAD_PM_VALID); in pfm_save_regs()
3402 pfm_save_regs(struct task_struct *task) in pfm_save_regs() argument
3407 ctx = PFM_GET_CTX(task); in pfm_save_regs()
3431 smp_processor_id(), task->pid, in pfm_save_regs()
3432 task->thread.flags & IA64_THREAD_PM_VALID); in pfm_save_regs()
3436 pfm_lazy_save_regs (struct task_struct *task) in pfm_lazy_save_regs() argument
3441 ctx = PFM_GET_CTX(task); in pfm_lazy_save_regs()
3442 t = &task->thread; in pfm_lazy_save_regs()
3444 DBprintk(("on [%d] used_pmds=0x%lx\n", task->pid, ctx->ctx_used_pmds[0])); in pfm_lazy_save_regs()
3473 pfm_load_regs (struct task_struct *task) in pfm_load_regs() argument
3481 ctx = PFM_GET_CTX(task); in pfm_load_regs()
3488 t = &task->thread; in pfm_load_regs()
3494 DBprintk(("[%d] PM_VALID=0, nothing to do\n", task->pid)); in pfm_load_regs()
3527 …if (pmc_mask || pmd_mask) DBprintk(("partial reload [%d] pmd_mask=0x%lx pmc_mask=0x%lx\n", task->p… in pfm_load_regs()
3547 task->pid, owner ? owner->pid : -1, in pfm_load_regs()
3561 struct pt_regs *regs = TASK_PTREGS(task); in pfm_load_regs()
3562 pfm_overflow_handler(task, ctx, t->pmc[0], regs); in pfm_load_regs()
3587 SET_PMU_OWNER(task); in pfm_load_regs()
3600 pfm_load_regs (struct task_struct *task) in pfm_load_regs() argument
3610 ctx = PFM_GET_CTX(task); in pfm_load_regs()
3611 t = &task->thread; in pfm_load_regs()
3639 if (owner == task) { in pfm_load_regs()
3644 DBprintk(("reload for [%d] owner=%d\n", task->pid, owner ? owner->pid : -1)); in pfm_load_regs()
3684 struct pt_regs *regs = TASK_PTREGS(task); in pfm_load_regs()
3685 pfm_overflow_handler(task, ctx, t->pmc[0], regs); in pfm_load_regs()
3717 SET_PMU_OWNER(task); in pfm_load_regs()
3731 pfm_reset_pmu(struct task_struct *task) in pfm_reset_pmu() argument
3733 struct thread_struct *t = &task->thread; in pfm_reset_pmu()
3737 if (task != current) { in pfm_reset_pmu()
3836 pfm_flush_regs (struct task_struct *task) in pfm_flush_regs() argument
3843 ctx = task->thread.pfm_context; in pfm_flush_regs()
3925 task->pid, GET_LAST_CPU(ctx)); in pfm_flush_regs()
3942 task->pid, in pfm_flush_regs()
3955 task->thread.pmd[i] = 0; in pfm_flush_regs()
3963 task->pid, i, ctx->ctx_soft_pmds[i].val)); in pfm_flush_regs()
3966 DBprintk(("[%d] pmd[%d] hw_pmd=0x%lx\n", task->pid, i, val)); in pfm_flush_regs()
3970 task->thread.pmd[i] = val; in pfm_flush_regs()
3981 pfm_inherit(struct task_struct *task, struct pt_regs *regs) in pfm_inherit() argument
3993 ctx = task->thread.pfm_context; in pfm_inherit()
3994 thread = &task->thread; in pfm_inherit()
4002 DBprintk(("enabling psr.sp for [%d]\n", task->pid)); in pfm_inherit()
4004 DBprintk(("psr.sp=%d [%d]\n", ia64_psr(regs)->sp, task->pid)); in pfm_inherit()
4021 task->thread.pfm_ovfl_block_reset = 0; in pfm_inherit()
4027 task->cpus_allowed = ctx->ctx_saved_cpus_allowed; in pfm_inherit()
4028 task->need_resched = 1; in pfm_inherit()
4031 task->pid, in pfm_inherit()
4041 DBprintk(("removing PFM context for [%d]\n", task->pid)); in pfm_inherit()
4043 task->thread.pfm_context = NULL; in pfm_inherit()
4067 DBprintk(("downgrading to INHERIT_NONE for [%d]\n", task->pid)); in pfm_inherit()
4162 DBprintk(("nctx=%p for process [%d]\n", (void *)nctx, task->pid)); in pfm_inherit()
4169 DBprintk(("setting PM_VALID for [%d]\n", task->pid)); in pfm_inherit()
4186 pfm_context_exit(struct task_struct *task) in pfm_context_exit() argument
4188 pfm_context_t *ctx = task->thread.pfm_context; in pfm_context_exit()
4199 task->pid, in pfm_context_exit()
4226 task->pid, in pfm_context_exit()
4242 task->pid, ctx, in pfm_context_exit()
4244 atomic_read(&task->thread.pfm_notifiers_check), task->mm)); in pfm_context_exit()
4267 task->pid, in pfm_context_exit()
4277 task->pid, in pfm_context_exit()
4286 pfm_unreserve_session(task, ctx->ctx_fl_system, 1UL << ctx->ctx_cpu); in pfm_context_exit()
4292 task->cpus_allowed = ctx->ctx_saved_cpus_allowed; in pfm_context_exit()
4293 task->need_resched = 1; in pfm_context_exit()
4300 task->thread.pfm_context = NULL; in pfm_context_exit()
4301 task->thread.pfm_ovfl_block_reset = 0; in pfm_context_exit()
4310 pfm_cleanup_smpl_buf(struct task_struct *task) in pfm_cleanup_smpl_buf() argument
4312 pfm_smpl_buffer_desc_t *tmp, *psb = task->thread.pfm_smpl_buf_list; in pfm_cleanup_smpl_buf()
4331 task->thread.pfm_smpl_buf_list = NULL; in pfm_cleanup_smpl_buf()
4341 pfm_cleanup_owners(struct task_struct *task) in pfm_cleanup_owners() argument
4346 DBprintk(("called by [%d] for [%d]\n", current->pid, task->pid)); in pfm_cleanup_owners()
4365 if (ctx && ctx->ctx_owner == task) { in pfm_cleanup_owners()
4366 DBprintk(("trying for owner [%d] in [%d]\n", task->pid, p->pid)); in pfm_cleanup_owners()
4386 DBprintk(("done for notifier [%d] in [%d]\n", task->pid, p->pid)); in pfm_cleanup_owners()
4391 atomic_set(&task->thread.pfm_owners_check, 0); in pfm_cleanup_owners()
4400 pfm_cleanup_notifiers(struct task_struct *task) in pfm_cleanup_notifiers() argument
4405 DBprintk(("called by [%d] for [%d]\n", current->pid, task->pid)); in pfm_cleanup_notifiers()
4424 if (ctx && ctx->ctx_notify_task == task) { in pfm_cleanup_notifiers()
4425 DBprintk(("trying for notifier [%d] in [%d]\n", task->pid, p->pid)); in pfm_cleanup_notifiers()
4445 DBprintk(("done for notifier [%d] in [%d]\n", task->pid, p->pid)); in pfm_cleanup_notifiers()
4450 atomic_set(&task->thread.pfm_notifiers_check, 0); in pfm_cleanup_notifiers()