From: Ingo Molnar Date: Mon, 3 Nov 2008 09:34:23 +0000 (+0100) Subject: Merge branches 'tracing/ftrace', 'tracing/markers', 'tracing/mmiotrace', 'tracing... X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7a895f53cda9d9362c30144e42c124a1ae996b9e;p=mv-sheeva.git Merge branches 'tracing/ftrace', 'tracing/markers', 'tracing/mmiotrace', 'tracing/nmisafe', 'tracing/tracepoints' and 'tracing/urgent' into tracing/core --- 7a895f53cda9d9362c30144e42c124a1ae996b9e diff --cc include/linux/ftrace.h index 899ec4b26b6,a3d46151be1,a3d46151be1,22240dfe912,703eb53cfa2,703eb53cfa2..e46a7b34037 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@@@@@@ -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); diff --cc kernel/trace/trace.c index 482583eb800,d345d649d07,d345d649d07,7f86067d760,8a499e2adae,85bee775a03..e4c40c868d6 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@@@@@@ -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) { @@@@@@@ -2431,35 -2414,8 -2414,8 -2413,8 -2418,8 -2420,8 +2433,35 @@@@@@@ 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; }