aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/oprofile_files.c
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2010-10-04 15:09:36 -0400
committerRobert Richter <robert.richter@amd.com>2010-10-12 11:25:06 -0400
commit7df01d96b295e400167e78061b81d4c91630b12d (patch)
tree52782cc1d78c24030d627f719cdaa29846c42efb /drivers/oprofile/oprofile_files.c
parent0361e02342f60b64a7075755d5851ed4e6f98c7d (diff)
oprofile: disable write access to oprofilefs while profiler is running
Oprofile counters are setup when profiling is disabled. Thus, writing to oprofilefs has no immediate effect. Changes are updated only after oprofile is reenabled. To keep userland and kernel states synchronized, we now allow configuration of oprofile only if profiling is disabled. In this case it checks if the profiler is running and then disables write access to oprofilefs by returning -EBUSY. The change should be backward compatible with current oprofile userland daemon. Acked-by: Maynard Johnson <maynardj@us.ibm.com> Cc: William Cohen <wcohen@redhat.com> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers/oprofile/oprofile_files.c')
-rw-r--r--drivers/oprofile/oprofile_files.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c
index bbd7516e0869..ccf099e684a4 100644
--- a/drivers/oprofile/oprofile_files.c
+++ b/drivers/oprofile/oprofile_files.c
@@ -79,14 +79,17 @@ static ssize_t depth_write(struct file *file, char const __user *buf, size_t cou
79 if (*offset) 79 if (*offset)
80 return -EINVAL; 80 return -EINVAL;
81 81
82 if (!oprofile_ops.backtrace)
83 return -EINVAL;
84
82 retval = oprofilefs_ulong_from_user(&val, buf, count); 85 retval = oprofilefs_ulong_from_user(&val, buf, count);
83 if (retval) 86 if (retval)
84 return retval; 87 return retval;
85 88
86 retval = oprofile_set_backtrace(val); 89 retval = oprofile_set_ulong(&oprofile_backtrace_depth, val);
87
88 if (retval) 90 if (retval)
89 return retval; 91 return retval;
92
90 return count; 93 return count;
91} 94}
92 95