Merge branches 'tracing/ftrace', 'tracing/markers', 'tracing/mmiotrace', 'tracing...
authorIngo Molnar <mingo@elte.hu>
Mon, 3 Nov 2008 09:34:23 +0000 (10:34 +0100)
committerIngo Molnar <mingo@elte.hu>
Mon, 3 Nov 2008 09:34:23 +0000 (10:34 +0100)
1  2  3  4  5  6 
include/linux/ftrace.h
kernel/trace/trace.c

@@@@@@@ -74,28 -79,6 -79,6 -74,31 -74,28 -74,28 +74,31 @@@@@@@ extern void ftrace_caller(void)
      extern void ftrace_call(void);
      extern void mcount_call(void);
      
+++ ++/* May be defined in arch */
+++ ++extern int ftrace_arch_read_dyn_info(char *buf, int size);
+++ ++
 ++   /**
 ++    * ftrace_modify_code - modify code segment
 ++    * @ip: the address of the code segment
 ++    * @old_code: the contents of what is expected to be there
 ++    * @new_code: the code to patch in
 ++    *
 ++    * This is a very sensitive operation and great care needs
 ++    * to be taken by the arch.  The operation should carefully
 ++    * read the location, check to see if what is read is indeed
 ++    * what we expect it to be, and then on success of the compare,
 ++    * it should write to the location.
 ++    *
 ++    * Return must be:
 ++    *  0 on success
 ++    *  -EFAULT on error reading the location
 ++    *  -EINVAL on a failed compare of the contents
 ++    *  -EPERM  on error writing to the location
 ++    * Any other value will be considered a failure.
 ++    */
 ++   extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
 ++                           unsigned char *new_code);
 ++   
      extern int skip_trace(unsigned long ip);
      
      extern void ftrace_release(void *start, unsigned long size);
@@@@@@@ -2407,7 -2375,22 -2375,22 -2373,23 -2378,23 -2380,23 +2409,7 @@@@@@@ static int tracing_set_tracer(char *buf
      {
        struct trace_array *tr = &global_trace;
        struct tracer *t;
 -----  char buf[max_tracer_type_len+1];
 -----  int i;
 -----  size_t ret;
   ---
   ---  ret = cnt;
 -----
 -----  if (cnt > max_tracer_type_len)
 -----          cnt = max_tracer_type_len;
 --     ret = cnt;
 -----
 -----  if (copy_from_user(&buf, ubuf, cnt))
 -----          return -EFAULT;
 -----
 -----  buf[cnt] = 0;
 -----
 -----  /* strip ending whitespace. */
 -----  for (i = cnt - 1; i > 0 && isspace(buf[i]); i--)
 -----          buf[i] = 0;
 +++++  int ret = 0;
      
        mutex_lock(&trace_types_lock);
        for (t = trace_types; t; t = t->next) {
       out:
        mutex_unlock(&trace_types_lock);
      
 --     if (ret == cnt)
 --             filp->f_pos += cnt;
 +++++  return ret;
 +++++}
 +++++
 +++++static ssize_t
 +++++tracing_set_trace_write(struct file *filp, const char __user *ubuf,
 +++++                  size_t cnt, loff_t *ppos)
 +++++{
 +++++  char buf[max_tracer_type_len+1];
 +++++  int i;
 +++++  size_t ret;
 +++++
 +++++  if (cnt > max_tracer_type_len)
 +++++          cnt = max_tracer_type_len;
 +++++
 +++++  if (copy_from_user(&buf, ubuf, cnt))
 +++++          return -EFAULT;
 +++++
 +++++  buf[cnt] = 0;
 +++++
 +++++  /* strip ending whitespace. */
 +++++  for (i = cnt - 1; i > 0 && isspace(buf[i]); i--)
 +++++          buf[i] = 0;
 +++++
 +++++  ret = tracing_set_tracer(buf);
 +++++  if (!ret)
 +++++          ret = cnt;
 +++++
 ++     if (ret > 0)
 ++             filp->f_pos += ret;
      
        return ret;
      }