aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/perfmon.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/kernel/perfmon.c')
-rw-r--r--arch/ia64/kernel/perfmon.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index f1782705b1f7..ab985f785c14 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -41,6 +41,7 @@
41#include <linux/rcupdate.h> 41#include <linux/rcupdate.h>
42#include <linux/completion.h> 42#include <linux/completion.h>
43#include <linux/tracehook.h> 43#include <linux/tracehook.h>
44#include <linux/slab.h>
44 45
45#include <asm/errno.h> 46#include <asm/errno.h>
46#include <asm/intrinsics.h> 47#include <asm/intrinsics.h>
@@ -522,42 +523,37 @@ EXPORT_SYMBOL(pfm_sysctl);
522 523
523static ctl_table pfm_ctl_table[]={ 524static ctl_table pfm_ctl_table[]={
524 { 525 {
525 .ctl_name = CTL_UNNUMBERED,
526 .procname = "debug", 526 .procname = "debug",
527 .data = &pfm_sysctl.debug, 527 .data = &pfm_sysctl.debug,
528 .maxlen = sizeof(int), 528 .maxlen = sizeof(int),
529 .mode = 0666, 529 .mode = 0666,
530 .proc_handler = &proc_dointvec, 530 .proc_handler = proc_dointvec,
531 }, 531 },
532 { 532 {
533 .ctl_name = CTL_UNNUMBERED,
534 .procname = "debug_ovfl", 533 .procname = "debug_ovfl",
535 .data = &pfm_sysctl.debug_ovfl, 534 .data = &pfm_sysctl.debug_ovfl,
536 .maxlen = sizeof(int), 535 .maxlen = sizeof(int),
537 .mode = 0666, 536 .mode = 0666,
538 .proc_handler = &proc_dointvec, 537 .proc_handler = proc_dointvec,
539 }, 538 },
540 { 539 {
541 .ctl_name = CTL_UNNUMBERED,
542 .procname = "fastctxsw", 540 .procname = "fastctxsw",
543 .data = &pfm_sysctl.fastctxsw, 541 .data = &pfm_sysctl.fastctxsw,
544 .maxlen = sizeof(int), 542 .maxlen = sizeof(int),
545 .mode = 0600, 543 .mode = 0600,
546 .proc_handler = &proc_dointvec, 544 .proc_handler = proc_dointvec,
547 }, 545 },
548 { 546 {
549 .ctl_name = CTL_UNNUMBERED,
550 .procname = "expert_mode", 547 .procname = "expert_mode",
551 .data = &pfm_sysctl.expert_mode, 548 .data = &pfm_sysctl.expert_mode,
552 .maxlen = sizeof(int), 549 .maxlen = sizeof(int),
553 .mode = 0600, 550 .mode = 0600,
554 .proc_handler = &proc_dointvec, 551 .proc_handler = proc_dointvec,
555 }, 552 },
556 {} 553 {}
557}; 554};
558static ctl_table pfm_sysctl_dir[] = { 555static ctl_table pfm_sysctl_dir[] = {
559 { 556 {
560 .ctl_name = CTL_UNNUMBERED,
561 .procname = "perfmon", 557 .procname = "perfmon",
562 .mode = 0555, 558 .mode = 0555,
563 .child = pfm_ctl_table, 559 .child = pfm_ctl_table,
@@ -566,7 +562,6 @@ static ctl_table pfm_sysctl_dir[] = {
566}; 562};
567static ctl_table pfm_sysctl_root[] = { 563static ctl_table pfm_sysctl_root[] = {
568 { 564 {
569 .ctl_name = CTL_KERN,
570 .procname = "kernel", 565 .procname = "kernel",
571 .mode = 0555, 566 .mode = 0555,
572 .child = pfm_sysctl_dir, 567 .child = pfm_sysctl_dir,
@@ -2206,7 +2201,7 @@ pfm_alloc_file(pfm_context_t *ctx)
2206{ 2201{
2207 struct file *file; 2202 struct file *file;
2208 struct inode *inode; 2203 struct inode *inode;
2209 struct dentry *dentry; 2204 struct path path;
2210 char name[32]; 2205 char name[32];
2211 struct qstr this; 2206 struct qstr this;
2212 2207
@@ -2231,18 +2226,19 @@ pfm_alloc_file(pfm_context_t *ctx)
2231 /* 2226 /*
2232 * allocate a new dcache entry 2227 * allocate a new dcache entry
2233 */ 2228 */
2234 dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this); 2229 path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
2235 if (!dentry) { 2230 if (!path.dentry) {
2236 iput(inode); 2231 iput(inode);
2237 return ERR_PTR(-ENOMEM); 2232 return ERR_PTR(-ENOMEM);
2238 } 2233 }
2234 path.mnt = mntget(pfmfs_mnt);
2239 2235
2240 dentry->d_op = &pfmfs_dentry_operations; 2236 path.dentry->d_op = &pfmfs_dentry_operations;
2241 d_add(dentry, inode); 2237 d_add(path.dentry, inode);
2242 2238
2243 file = alloc_file(pfmfs_mnt, dentry, FMODE_READ, &pfm_file_ops); 2239 file = alloc_file(&path, FMODE_READ, &pfm_file_ops);
2244 if (!file) { 2240 if (!file) {
2245 dput(dentry); 2241 path_put(&path);
2246 return ERR_PTR(-ENFILE); 2242 return ERR_PTR(-ENFILE);
2247 } 2243 }
2248 2244
@@ -2298,7 +2294,7 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t
2298 * if ((mm->total_vm << PAGE_SHIFT) + len> task->rlim[RLIMIT_AS].rlim_cur) 2294 * if ((mm->total_vm << PAGE_SHIFT) + len> task->rlim[RLIMIT_AS].rlim_cur)
2299 * return -ENOMEM; 2295 * return -ENOMEM;
2300 */ 2296 */
2301 if (size > task->signal->rlim[RLIMIT_MEMLOCK].rlim_cur) 2297 if (size > task_rlimit(task, RLIMIT_MEMLOCK))
2302 return -ENOMEM; 2298 return -ENOMEM;
2303 2299
2304 /* 2300 /*
@@ -2320,6 +2316,7 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t
2320 DPRINT(("Cannot allocate vma\n")); 2316 DPRINT(("Cannot allocate vma\n"));
2321 goto error_kmem; 2317 goto error_kmem;
2322 } 2318 }
2319 INIT_LIST_HEAD(&vma->anon_vma_chain);
2323 2320
2324 /* 2321 /*
2325 * partially initialize the vma for the sampling buffer 2322 * partially initialize the vma for the sampling buffer
@@ -2718,7 +2715,7 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
2718 goto buffer_error; 2715 goto buffer_error;
2719 } 2716 }
2720 2717
2721 DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d \n", 2718 DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d\n",
2722 ctx, 2719 ctx,
2723 ctx_flags, 2720 ctx_flags,
2724 ctx->ctx_fl_system, 2721 ctx->ctx_fl_system,
@@ -3523,7 +3520,7 @@ pfm_use_debug_registers(struct task_struct *task)
3523 * IA64_THREAD_DBG_VALID set. This indicates a task which was 3520 * IA64_THREAD_DBG_VALID set. This indicates a task which was
3524 * able to use the debug registers for debugging purposes via 3521 * able to use the debug registers for debugging purposes via
3525 * ptrace(). Therefore we know it was not using them for 3522 * ptrace(). Therefore we know it was not using them for
3526 * perfmormance monitoring, so we only decrement the number 3523 * performance monitoring, so we only decrement the number
3527 * of "ptraced" debug register users to keep the count up to date 3524 * of "ptraced" debug register users to keep the count up to date
3528 */ 3525 */
3529int 3526int
@@ -3682,7 +3679,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
3682 * "self-monitoring". 3679 * "self-monitoring".
3683 */ 3680 */
3684 if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) { 3681 if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) {
3685 DPRINT(("unblocking [%d] \n", task_pid_nr(task))); 3682 DPRINT(("unblocking [%d]\n", task_pid_nr(task)));
3686 complete(&ctx->ctx_restart_done); 3683 complete(&ctx->ctx_restart_done);
3687 } else { 3684 } else {
3688 DPRINT(("[%d] armed exit trap\n", task_pid_nr(task))); 3685 DPRINT(("[%d] armed exit trap\n", task_pid_nr(task)));