aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/include/asm/ftrace.h4
-rw-r--r--arch/powerpc/include/asm/ftrace.h4
-rw-r--r--arch/sh/include/asm/ftrace.h4
-rw-r--r--arch/sparc/include/asm/ftrace.h4
-rw-r--r--arch/x86/include/asm/ftrace.h10
-rw-r--r--arch/x86/kernel/ftrace.c16
-rw-r--r--include/linux/ftrace.h3
-rw-r--r--kernel/trace/trace.c9
8 files changed, 28 insertions, 26 deletions
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index d4c24a7a9280..3f3a1d1508ea 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -2,8 +2,8 @@
2#define _ASM_ARM_FTRACE 2#define _ASM_ARM_FTRACE
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#define ftrace_nmi_enter() do { } while (0) 5static inline void ftrace_nmi_enter(void) { }
6#define ftrace_nmi_exit() do { } while (0) 6static inline void ftrace_nmi_exit(void) { }
7#endif 7#endif
8 8
9#ifdef CONFIG_FUNCTION_TRACER 9#ifdef CONFIG_FUNCTION_TRACER
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
index 7652755dc000..1cd72700fbc0 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -2,8 +2,8 @@
2#define _ASM_POWERPC_FTRACE 2#define _ASM_POWERPC_FTRACE
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#define ftrace_nmi_enter() do { } while (0) 5static inline void ftrace_nmi_enter(void) { }
6#define ftrace_nmi_exit() do { } while (0) 6static inline void ftrace_nmi_exit(void) { }
7#endif 7#endif
8 8
9#ifdef CONFIG_FUNCTION_TRACER 9#ifdef CONFIG_FUNCTION_TRACER
diff --git a/arch/sh/include/asm/ftrace.h b/arch/sh/include/asm/ftrace.h
index cdf2cb0b9ffe..31ada0370cb6 100644
--- a/arch/sh/include/asm/ftrace.h
+++ b/arch/sh/include/asm/ftrace.h
@@ -2,8 +2,8 @@
2#define __ASM_SH_FTRACE_H 2#define __ASM_SH_FTRACE_H
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#define ftrace_nmi_enter() do { } while (0) 5static inline void ftrace_nmi_enter(void) { }
6#define ftrace_nmi_exit() do { } while (0) 6static inline void ftrace_nmi_exit(void) { }
7#endif 7#endif
8 8
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
diff --git a/arch/sparc/include/asm/ftrace.h b/arch/sparc/include/asm/ftrace.h
index 33a95feeb137..62055ac0496e 100644
--- a/arch/sparc/include/asm/ftrace.h
+++ b/arch/sparc/include/asm/ftrace.h
@@ -2,8 +2,8 @@
2#define _ASM_SPARC64_FTRACE 2#define _ASM_SPARC64_FTRACE
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#define ftrace_nmi_enter() do { } while (0) 5static inline void ftrace_nmi_enter(void) { }
6#define ftrace_nmi_exit() do { } while (0) 6static inline void ftrace_nmi_exit(void) { }
7#endif 7#endif
8 8
9#ifdef CONFIG_MCOUNT 9#ifdef CONFIG_MCOUNT
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index f2ed6b704a75..a23468194b8c 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -22,16 +22,16 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
22extern void ftrace_nmi_enter(void); 22extern void ftrace_nmi_enter(void);
23extern void ftrace_nmi_exit(void); 23extern void ftrace_nmi_exit(void);
24#else 24#else
25#define ftrace_nmi_enter() do { } while (0) 25static inline void ftrace_nmi_enter(void) { }
26#define ftrace_nmi_exit() do { } while (0) 26static inline void ftrace_nmi_exit(void) { }
27#endif
28#endif 27#endif
28#endif /* __ASSEMBLY__ */
29 29
30#else /* CONFIG_FUNCTION_TRACER */ 30#else /* CONFIG_FUNCTION_TRACER */
31 31
32#ifndef __ASSEMBLY__ 32#ifndef __ASSEMBLY__
33#define ftrace_nmi_enter() do { } while (0) 33static inline void ftrace_nmi_enter(void) { }
34#define ftrace_nmi_exit() do { } while (0) 34static inline void ftrace_nmi_exit(void) { }
35#endif 35#endif
36 36
37#endif /* CONFIG_FUNCTION_TRACER */ 37#endif /* CONFIG_FUNCTION_TRACER */
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 6685b0fc1b44..69149337f2fe 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -67,7 +67,7 @@ unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
67 * 67 *
68 * Two buffers are added: An IP buffer and a "code" buffer. 68 * Two buffers are added: An IP buffer and a "code" buffer.
69 * 69 *
70 * 1) Put in the instruction pointer into the IP buffer 70 * 1) Put the instruction pointer into the IP buffer
71 * and the new code into the "code" buffer. 71 * and the new code into the "code" buffer.
72 * 2) Set a flag that says we are modifying code 72 * 2) Set a flag that says we are modifying code
73 * 3) Wait for any running NMIs to finish. 73 * 3) Wait for any running NMIs to finish.
@@ -85,14 +85,14 @@ unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
85 * are the same as what exists. 85 * are the same as what exists.
86 */ 86 */
87 87
88static atomic_t in_nmi; 88static atomic_t in_nmi = ATOMIC_INIT(0);
89static int mod_code_status; 89static int mod_code_status; /* holds return value of text write */
90static int mod_code_write; 90static int mod_code_write; /* set when NMI should do the write */
91static void *mod_code_ip; 91static void *mod_code_ip; /* holds the IP to write to */
92static void *mod_code_newcode; 92static void *mod_code_newcode; /* holds the text to write to the IP */
93 93
94static int nmi_wait_count; 94static unsigned nmi_wait_count;
95static atomic_t nmi_update_count; 95static atomic_t nmi_update_count = ATOMIC_INIT(0);
96 96
97int ftrace_arch_read_dyn_info(char *buf, int size) 97int ftrace_arch_read_dyn_info(char *buf, int size)
98{ 98{
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 703eb53cfa2b..22240dfe912e 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -74,6 +74,9 @@ extern void ftrace_caller(void);
74extern void ftrace_call(void); 74extern void ftrace_call(void);
75extern void mcount_call(void); 75extern void mcount_call(void);
76 76
77/* May be defined in arch */
78extern int ftrace_arch_read_dyn_info(char *buf, int size);
79
77/** 80/**
78 * ftrace_modify_code - modify code segment 81 * ftrace_modify_code - modify code segment
79 * @ip: the address of the code segment 82 * @ip: the address of the code segment
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index bc36febc0771..7f86067d760c 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2815,10 +2815,6 @@ static struct file_operations tracing_mark_fops = {
2815 2815
2816#ifdef CONFIG_DYNAMIC_FTRACE 2816#ifdef CONFIG_DYNAMIC_FTRACE
2817 2817
2818#define DYN_INFO_BUF_SIZE 1023
2819static char ftrace_dyn_info_buffer[DYN_INFO_BUF_SIZE+1];
2820static DEFINE_MUTEX(dyn_info_mutex);
2821
2822int __weak ftrace_arch_read_dyn_info(char *buf, int size) 2818int __weak ftrace_arch_read_dyn_info(char *buf, int size)
2823{ 2819{
2824 return 0; 2820 return 0;
@@ -2828,14 +2824,17 @@ static ssize_t
2828tracing_read_dyn_info(struct file *filp, char __user *ubuf, 2824tracing_read_dyn_info(struct file *filp, char __user *ubuf,
2829 size_t cnt, loff_t *ppos) 2825 size_t cnt, loff_t *ppos)
2830{ 2826{
2827 static char ftrace_dyn_info_buffer[1024];
2828 static DEFINE_MUTEX(dyn_info_mutex);
2831 unsigned long *p = filp->private_data; 2829 unsigned long *p = filp->private_data;
2832 char *buf = ftrace_dyn_info_buffer; 2830 char *buf = ftrace_dyn_info_buffer;
2831 int size = ARRAY_SIZE(ftrace_dyn_info_buffer);
2833 int r; 2832 int r;
2834 2833
2835 mutex_lock(&dyn_info_mutex); 2834 mutex_lock(&dyn_info_mutex);
2836 r = sprintf(buf, "%ld ", *p); 2835 r = sprintf(buf, "%ld ", *p);
2837 2836
2838 r += ftrace_arch_read_dyn_info(buf+r, DYN_INFO_BUF_SIZE-r); 2837 r += ftrace_arch_read_dyn_info(buf+r, (size-1)-r);
2839 buf[r++] = '\n'; 2838 buf[r++] = '\n';
2840 2839
2841 r = simple_read_from_buffer(ubuf, cnt, ppos, buf, r); 2840 r = simple_read_from_buffer(ubuf, cnt, ppos, buf, r);