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-Tag: v3.12-rc1~14389^2~506 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a895f53cda9d9362c30144e42c124a1ae996b9e;p=kernel%2Fkernel-generic.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 899ec4b,a3d4615,a3d4615,22240df,703eb53,703eb53..e46a7b3 --- 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 482583e,d345d64,d345d64,7f86067,8a499e2,85bee77..e4c40c8 --- 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; }